
Hello, I need to make a sort of loop so a text is displayed several times. So this idea : repeat 3 true will be True True True. So in another language I would have programmed. for teller = 1 to a print text But I need to use list comprehession. So I thougt I use this : replicate :: Int -> a -> [a] replicate a xs = [xs | x' <= a <-xs] But now I get this message : oefening.hs:2:24: Parse error in pattern: x' <= a Where did I go wrong here ? Roelof

Hi Roelof,
For small questions like this, you might want to try the Haskell
IRC channel (http://www.haskell.org/haskellwiki/IRC_channel).
Tom
On 7/20/11, Roelof Wobben
Hello,
I need to make a sort of loop so a text is displayed several times.
So this idea :
repeat 3 true will be True True True.
So in another language I would have programmed.
for teller = 1 to a print text
But I need to use list comprehession.
So I thougt I use this :
replicate :: Int -> a -> [a] replicate a xs = [xs | x' <= a <-xs]
But now I get this message :
oefening.hs:2:24: Parse error in pattern: x' <= a
Where did I go wrong here ?
Roelof
participants (2)
-
Roelof Wobben
-
Tom Murphy