Challenge: change one function in the following pipeline so that t
doesn't blow up when executed in ghci.

import qualified Data.Set as S
t = last . take (10^6) . iterate f $ S.empty
f s = S.delete 1 . S.insert 1 $ s

Please suggest more of these types of exercises if you have them and
maybe we can collect the folk wisdom into a wiki page and/or exercise
page for beginners.

spoiler for the above problem below :)

































































myiterate f x =
  let nxt = f x
  in nxt `seq` x : myiterate f nxt
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to