Re: [Haskell] Binary Tree Traversal.

2005-03-10 Thread Stefan Holdermans
Paul, Are you sure this isn't homework? ;) data BinTree a = Nil | Node a (BinTree a) (BinTree a) inorder2 :: BinTree a -> [a] -> [a] inorder2 Nil xs = [] inorder2 (Node val b1 b2) xs = (inorder2 b1 (val:(inorder2 b2 (xs Review the case for []. What does the parameter xs represent? How should i

[Haskell] Binary Tree Traversal.

2005-03-10 Thread Paul Chen
data BinTree a = Nil | Node a (BinTree a) (BinTree a) inorder2 :: BinTree a -> [a] -> [a] inorder2 Nil xs = [] inorder2 (Node val b1 b2) xs = (inorder2 b1 (val:(inorder2 b2 (xs I want to be able to traverse across the binary tree in order and that is what I have so far. But somehow it always r