Questions tagged as 'haskell'

2
answers

how to compare an item in a Haskell list

I was trying to make a function that compares a given item with a list and if the item is on the list it returns a Boolean. when compiling it, it throws this error at me and I do not understand what it refers to. I would appreciate your help...
asked by 14.09.2018 / 07:40
3
answers

Distribute List in list tuple (Haskell)

We have the following function: repartir [a] -> ([a],[a]) In order to distribute, you must distribute the main list in two lists, taking the elements in this way: repartir [1,2,3,4,5] ---> ([1,3,5],[2,4]) repartir "hola" --->...
asked by 25.10.2016 / 09:45
2
answers

Error: parse error on input '|'

libreDeCuadrados :: Integer -> Bool libreDeCuadrados x = sumaPrimos x 2 0 where sumaPrimos x c s | c == x && s == x = True -- Caso Base 1 | c == x && s /= x = False -- Caso Base 2...
asked by 24.10.2017 / 20:59
2
answers

Parse error in Haskell

I am new to Haskell and also in programming. I'm trying to learn Haskell with exercises already done. Just now I get an error that says the following.    error: parse error on input "n", failed modules load: none From the following cod...
asked by 22.10.2016 / 01:10
2
answers

Type constructors vs. data constructors (Haskell)

If you create a vector with two generic components, such as: data Vector a = MakeVector a a (I put MakeVector instead of Vector on purpose) ( Vector a ) is the type constructor while ( MakeVector ) is the data c...
asked by 22.03.2016 / 11:19
2
answers

Error "unification would give infinite type" in haskell

I'm trying to define a function that given an element and a list to count the number of times that element appears on that list, then I have: cuantasVecesAparece :: Eq a => a -> [a] -> Int cuantasVecesAparece p [] = 0 cuantasVecesApar...
asked by 05.04.2017 / 02:52
1
answer

Haskell, division without div

Hello, I have a problem in hand, try to make a code in Haskell with the following conditions: We introduce two numbers a y b to be divided a/b of type Integer , so that we take your module and your coscious one With the...
asked by 06.10.2016 / 18:32
2
answers

Haskell. Lists

Good afternoon. I need to create a function in Haskell that verifies that several elements are in that order in a given list. That is: se_encuentra [5,4,7] [1,4,5,4,7,9,10] == True se_encuentra [5,4,7] [1,4,6,6,5,4,0,7]...
asked by 08.01.2018 / 17:18
1
answer

how can I remove the quotes from a string in the output of a file in haskell

writeFile "CRITICOS.txt" (show ([head nodocritico])) but in the file shows it to me so ["C"] and I want to put it so [C] as I could remove the double quotes?     
asked by 29.06.2017 / 04:51
1
answer

Ignore items from a list of tuples

I have a list of String [A,B] And I have this tuple [("A","B"),("A","C"),("B","A"),("B","C"),("C","A"),("C","B"),("C","D"),("D","C")] I want to delete the items in the list from the list [A,B] ie get the next resu...
asked by 28.06.2017 / 05:10