Hello Brandon S. Allbery KF8NH,

depth emptyBT = 0
depth (NodeBT _ left right) = max (1 + depth left) (1 + depth right)
If you use a variable in a pattern match, it creates a new binding
which irrefutably matches the corresponding argument.  In other
words, you get a new local variable "emptyBT", ignoring your global.
You must use the actual constructor instead.

I was wondering why depth always returned zero... Thanks. :-)



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to