Questions tagged as 'haskell'

1
answer

haskell perimeter lists

Could you help me do this?: perimetro :: (Ord a) => [a] -> [a] -> Float perimetro [] [] = 0.0 perimetro xt xs = I do not know how to get the first and last item out of each list at the same time to be able to operate them....
asked by 19.09.2017 / 21:23
1
answer

List of functions in Haskell

How can I define a list whose elements are functions? What would be the type to define if I have a data type?: data Usuario = UnUsuario String [**--que tipo pondria aca--**] deriving Show     
asked by 04.06.2017 / 23:57
1
answer

Generate a table of codes from Huffman's Tree

given a tree of the type: data THuffman = Hoja Char | Nodo THuffman THuffman and with the data type type TablaCodigo = [(Char,String)] I must create a function extraerCodigos :: THuffman -> TablaCodigo That I generate a table o...
asked by 04.05.2017 / 04:06
1
answer

How to convert list list to list?

In Haskell , I have the following problem: I have the following list: [[17,16,15],[14,13,12],[11,10,9],[8,7,6],[5,4,3],[2,1]] And I would like to get [17,16,14,13,11,10,8,7,5,4,2,1] That is: from each 3-tuple, delete the last...
asked by 07.01.2018 / 09:19
2
answers

Help with the SUMA function in Haskell ghci

Use ghci in notepad ++ I have the following function: suma :: (Integer, Integer) -> (Integer) suma (x,y) = x + y Running this on the console: *Main> suma (3,5) I get the following error: <interactive>:6:1: error: *...
asked by 31.10.2017 / 00:04
3
answers

Sum in Haskell [closed]

I need to do the summation from i = 1 to n of i ^ n in Haskell. Anyone have an idea or can you help me do it? I'm doing a project and I need that in haskell that I do not have much idea.     
asked by 18.06.2016 / 18:29