
27 Mar
2007
27 Mar
'07
10:02 a.m.
Matthias Fischmann:
g = do n <- randomRIO (0,5) let l = replicate n '*' i | null l = [] | otherwise = join $ repeat l print (take 12 i)
If you had written (cycle l) instead of (join $ repeat l), you would have figured it out much quicker. :-) Prelude> cycle [] *** Exception: Prelude.cycle: empty list