You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was surprised that the binary-search-tree exercise doesn't allow solutions where the BST can be empty.
The problem is that the bstValue function is of type BST a -> a instead of of BST a -> Maybe a.
This also means that the fromList function must have a special case where it returns an error for the empty list.
I was surprised that the binary-search-tree exercise doesn't allow solutions where the BST can be empty.
The problem is that the
bstValue
function is of typeBST a -> a
instead of ofBST a -> Maybe a
.This also means that the
fromList
function must have a special case where it returns an error for the empty list.In the example solution the BST is defined as:
Wouldn't a definition like the following be nicer?
The text was updated successfully, but these errors were encountered: