[Haskell-beginners] list problem

Roelof Wobben r.wobben at home.nl
Mon Mar 3 16:55:34 UTC 2014


Hello,

I have this :

cons8 n l = n : l
x = cons8 8 [1,2,3]

main = print x

This will be the output:    [8.1.2.3]

Now the problem is how I can take care that the output will be [1,2,3,4,8]
I have to change the function for it.

I tried switching n and L in the function but that will not work.
Or does I have to do x = cons [1,2,3] 8 and make the function like this 
cons8 l n = l : n

Roelof


---
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is.
http://www.avast.com



More information about the Beginners mailing list