Der Blog

Monadic fractals

There are an awful lot of monad tutorials out there. Monads as containers is one I saw a link to on haskell-cafe today, and it gives a rather amazing application of the list monad:

f x | x == '#'  = "# #"
    | otherwise = "   "

"#" >>= f >>= f >>= f >>= f
= "# #   # #         # #   # #                           # #   # #         # #   # #"

And we have a fractal!

[ Entry posted at: Sun 17 Dec 2006 03:22:53 GMT | 0 comment(s)... | Cat: Geeky ]

Add Comment

Validate : XHTML / CSS / RSS / ATOM