As you probably know I am desperately trying to come up with a good STL
like abstraction (that is a collection of generically containers and
algorithms that can easily work together), however I hit a stumbling
block that I thought some of you Haskell experts can help me with.

I would like to know if there is one good efficient function (or way)
that will allow me to *effectually* walk through a container in a list
like manner.  On the surface I could just use lazy lists however, as
implemented in ghc, they carry a huge amount of overhead.  While it is
also possible define these all these functions (foldr, foldl, zip,
union, etc) in terms of foldl or foldr in really, as shown in a previous
post, this is horribly inefficient.  It seams like my Generator concept,
which I just posted 2 days ago, would be a good way to go because GHC is
able to optimize away any garbage collection when used with simple
things like integer, but I am not sure how well that will work for a
tree like structure.

So I am asking you: Is there one really efficient function (or way) I
can use to define all list like functions with such as foldr, foldl,
foldr1, foldl1, zip, zip3, union on sorted ranges,  etc on any sort of
container.  This function needs to be efficient enough so that when
other functions are defined in terms of it there will be nearly as
efficient (within 10% or so) as writing the function directly based on
the structure of the container.
-- 
Kevin Atkinson
[EMAIL PROTECTED]
http://metalab.unc.edu/kevina/


Reply via email to