Hi everybody,
I studied haskell this semester at the university and I was required to
implement a binary search tree in haskell.
I would appreciate if anyone could send me an example code of this data
structure.
Just read a standard textbook. Some useful course notes
by Jeroen Fokker are
Hi Andrew,
| Hey all.. I was wondering if somebody might offer me some assistance in
| trying to debug some code I wrote to check whether a tree is a binary
| search tree.. For some reason it always comes back as false! :( Thanks
| much!
One of the great things about functional programming is
Mon, 17 Apr 2000 14:47:49 -0400 (EDT), Sitzman [EMAIL PROTECTED] pisze:
| otherwise = False
2
/ should be a BST too.
1
checkL = ((treeVal (leftSub thetree)) (treeVal (thetree)))
checkR = ((treeVal (rightSub thetree)) (treeVal (thetree)))
It's not enough:
3
/ \
2
Assuming this isn't a homework exercise...
1) If current node is empty then this portion of tree is a BST
2) if the left subtree and right subtree's are both not empty then ...
The logical negation of your second clause (which is what is picked
up by the 'otherwise' clause of your code) is
On Fri 17 Apr, Dave Tweed wrote:
On Thu, 16 Apr 1998, S. Alexander Jacobson wrote:
All that being said, we can say that there are certain properties that
all haskell functions must fulfill. For example a recursive function
should never call itself with the arguments that it recieved.
On Thu, 16 Apr 1998, S. Alexander Jacobson wrote:
All that being said, we can say that there are certain properties that
all haskell functions must fulfill. For example a recursive function
should never call itself with the arguments that it recieved.
e.g. myFunction 2 3 should not make
Not to reject assertions (they would be welcome), but I think that you
need something slightly different in a functional programming language.
Assertions in procedural languages typically define system state before
and after a particular function gets executed.
State assertions are less
Various people write:
Cc: [EMAIL PROTECTED], [EMAIL PROTECTED]
Can I ask people to be careful to which haskell-list address(es) they
followup to? My understanding is that list messages ought to be sent
_only_ to [EMAIL PROTECTED], and that any other addresses are symptoms
(and in some cases
2. how would I have found/fixed such an error in a more complex function
w/o assertions and w/o print statements?
Good questions
There was a proposal to put assertions into Std Haskell, which we
have implemented in GHC. (I'm not sure we've yet put that version out
though.) So
On Thu, 16 Apr 1998, Simon L Peyton Jones wrote:
2. how would I have found/fixed such an error in a more complex function
w/o assertions and w/o print statements?
Good questions
There was a proposal to put assertions into Std Haskell, which we
have implemented in GHC. (I'm not
10 matches
Mail list logo