As an exercise, I implemented breadth-first tree traversal (instead of the much more common depth-first tree traversal) in Haskell. It took me about 3 hours, mainly because I haven't even finished reading the turorial yet. It really struck me how truly lazy Haskell is! My own language, Squeamish, had lazy evaluation, but in Haskell, you have to somewhat bend over backwards with the imperative stuff to say, "Yeah, really, I'm done defining stuff. Uh, can you actually, uh, do some evaluation or something, and, uh, maybe even print the answer?" {- Implement breadth-first tree traversal. Name: Shannon -jj Behrens Date: Tue Dec 13 03:18:34 PST 2005 -} module Main where -- The main definition of a tree. data Tree a = Leaf a | Branch a (Tree a) (Tree a) -- Depth-first tree traversal. depthFirst :: Tree a -> [a] depthFirst (Leaf x) = [x] depthFirst (Branch x left right) = depthFirst left ++ [x] ++