Hi,
say if I want to sum a list of numbers but only until
it hits a max limit.
Currently, I control it through the function and
basically do nothing when the max is hit. However, if
the list is very long, would this mean the same
function would be called for the rest of the list
which can be a
Still a bit confused.
My function is simply
f x y = if x 100 then x + y else x
Sure the rest of y will not be touched(so if it is a
file reading operation, no actual i/o will ever be
performed) as they are not needed. But how would foldl
knows that my logic won't need some other item in the
Thanks. But how would I think about using scanl
instead of foldl(or foldl') when I want is the sum,
but not the progressive result. Once again show me
that I need to throw away all imperative stuff.
Oh, BTW, the reason I asked is that I was playing with
python which has a reduce function that
Once again, many thanks to all who taught me about
this small little problem. Don't even know there is
init/last and thought there is only head/tail.
But just for my curiosity, would the takeWhile still
store the intermediate result till my result is
reached ? If so, and my list is really very
Hi,
I just start learning haskell and have to say that it
is stunning in how precise it can be(coming from a
background of C then python/perl/js).
I want to write apps for WEB and have briefly read
WASH. However, that seems to be a CGI based solution.
What I want is a native HTTP server(written
Ah, lambda, function as first order object and curry.
A million thanks, that clears my mind. It is very hard
for me to shake away the things that I have learnt for
over 20 years. I still think from time to time that
the accumulator in foldr/foldl as a constant being
folded and forget that it can
: gary ng [EMAIL PROTECTED]
To: haskell-cafe@haskell.org
Subject: [Haskell-cafe] Where to start about
writing web/HTTP apps ?
Date: Sat, 10 Sep 2005 04:15:45 -0700 (PDT)
Hi,
Hi,
I just start learning haskell and have to say
that it
is stunning in how precise it can be(coming from