[Haskell-cafe] Re: iterative algorithms: how to do it in Haskell?

Gene A yumagene at gmail.com
Mon Aug 21 11:40:44 EDT 2006

Hi All,
I got up this morning {after not much sleep} to find these very
helpful suggestions/comments:

from Scott Turner:
{... See:  http://www.haskell.org/hawiki/ExistentialTypes ...}

>From Bulat Ziganshin:
you can read recent discussion on this in this topic, or look at

>From Lennart Augustsson,
A wonderfully instructive code fragment:
data Value = D Double | S String | B Bool
type Stack = [Value]
-- Add top stack elements
plus :: Stack -> Stack
plus (D x : D y : vs) = D (x+y) : vs
plus (  _ :   _ :  _) = error "Bad operands to plus"
plus                _ = error "Not enough operands on stack"
...}  see his post for the continuation...

With these suggestions I have plenty to study now.. and probably a whole
redesign of some of the things that I have already implemented.. with
most likely a great boost in speed of execution, and much cleaner
code.  I must admit that some of these concepts have not come as
easily to me as to some that have had formal education in these
matters... This list and the materials from Haskell.org, papers on
various websites, and documentation with GHC and it's libraries are my
entire exposure.. so when stuck, kind folks from the net community are
my, I guess mentors would be the word I am looking for... and for that
I am very greatful!
I am not in a real race... but I have to thank everyone that
participated in this spawned off of the main topic discussion... for
all their patience with my questions..

Thanks again to All for the clarification and links to more reading,

More information about the Haskell-Cafe mailing list