Questions tagged as 'haskell'

2
answers

Separate a Haskell list into an odd and even tuple

I have the following function: ParesImpares:: [Integer] -> ([Integer],[Integer]) I have to draw the odd and even pairs from a list: ParesImpares [3,2,4,5,7] - > ([2,4],[3,5,7]) My code so far is this: paresImpare...
asked by 13.10.2016 / 11:26
1
answer

Compare two element-by-element lists in HASKELL (RESOLVED)

I've been searching before opening a topic but I can not find something like what I need. It is the case that I have to compare two lists with a certain condition, element by element, but I am incapable. The function has to return a Bool, Tru...
asked by 23.10.2018 / 18:29
1
answer

Parameter .. List of lists .. and averages

I would like to know how to do in haskell to pass a list of lists by parameter ..? And to get averages with those lists? I need you to return only a list that has the averages of each of the lists that contains the list .. I mean .. [[8,6], [6,2...
asked by 28.03.2018 / 04:47
0
answers

Haskell: foldl error [closed]

I'm trying to make a hamming coding in haskell, i have a function "calculateParity" that takes a list of pairs [(Char, Int)] which are the bit (as Char) and the index (Int, starting at 1) in the list of bits, the second parameter is the position...
asked by 30.03.2017 / 21:56
2
answers

how to transform two lists into a list of tuples in haskell

I have this list ["A","B","C","D"] and this other [["B","C"],["A","C"],["A","B","D"],["C"]] and I want to convert it to this [("A","B"),("A","C"),("B","A"),("B","C"),("C","A"),("C","B"),("C","D"),("D","C")] for each element...
asked by 19.06.2017 / 20:31
2
answers

Sort tuple (a, a, a)

Hello, I have the following tuple: ordena :: Ord a => (a,a,a) -> (a,a,a) to see this does not have much complication but as I do I get a very ugly and long code. In this case I ask to see if there is some kind of recursion that I c...
asked by 16.10.2016 / 11:41
1
answer

Delete repeated items from a list

I am trying to make a function in haskell, where a list enters it by parameter and returns or shows the list but that the duplicates are eliminated, that is to say: Enter [1,2,3,4,1,2] and show [1,2,3,4] . It can also be with cha...
asked by 23.08.2018 / 04:16
1
answer

Delete consecutive characters from a list in Haskell

Very good to all, to see if you can help me. I have a problem when I want to remove all the consecutive items from a list that comply with the condition of being an upper case and a lowercase one and returning the rest of the list to me. Example...
asked by 25.03.2018 / 19:42
1
answer

Modify Tupla from Haskell

How can I modify a tuple in a txt file from Haskell ? I have a file .hs where you have the example below, what I want to know is how to add another tuple to the file from WinGhci . Example: alumnos :: [(Integer,[Char],Int...
asked by 15.05.2017 / 21:07
2
answers

I need to know the value of the medium in a tuple (Haskell)

Hi, I'm doing logic exercises with haskell and I have to extract the value from the middle of a tuple of 3 using the "maximum" and "minimum" functions developed below. maximo :: (Int,Int)->Int maximo (x,y) = if x > y then x else y minim...
asked by 17.12.2018 / 14:38