[Haskell-beginners] Translating imperative algorithms to Haskell

Stephen Tetley stephen.tetley at gmail.com
Sun Feb 21 07:31:59 EST 2010


Hello all

How are search trees generated and what is their 'shape' - i.e. leaf
labelled, node labelled, binary trees or rose trees?

I've a functional reformulation of the Wikipedia algorithm which is
about the same line count (excepting auxiliaries, which is a bit of a
cheat), but its producing bad results on a leaf and node labelled rose
tree.

By the way, the imperative essence of the negascout algorithm and what
makes it elegant is how it cuts off (control flow), rather than
statefulness (assignment). Even though the line count is roughly the
same and I believe I match the traversal behaviour / cut offs, the
imperative version is simply nicer than my functional version.

Best wishes

Stephen


More information about the Beginners mailing list