> user> (use '[clojure.contrib.seq-utils :only (reductions)])
> nil
> user> (reductions + [1 2 3 4 5])
> (1 3 6 10 15)
Yeah, I think it 'smart'. Thanks for a nice solution.
Yuto HAYAMIZU
On 4ζ11ζ₯, εεΎ11:48, Steve Purcell wrote:
> On 10 Apr 2010, at 08:46, Yuto Hayamizu wrote:
>
>
>
> > Hi,
Hi,
If you know any smart solutions with only currently available
functions, please tell me. I mean, 'smart' solutions have no explicit
'lazy-seq', recursion, and return a lazy sequence as a result.
How about using clojure.contrib.seq-utils/reductions?
> user> (accum-seq [1, 1, 1, 1, 1])
> (
On 10 Apr 2010, at 08:46, Yuto Hayamizu wrote:
> Hi, all
>
> I want some list functions in Haskell like mapAccumL in
> clojure.contrib, because some sequence operations are difficult with
> only functions in clojure.core and contrib.
>
> Think about writing a function 'accum-seq', which takes a
Hi, all
I want some list functions in Haskell like mapAccumL in
clojure.contrib, because some sequence operations are difficult with
only functions in clojure.core and contrib.
Think about writing a function 'accum-seq', which takes a sequence of
numbers, and returns a sequence of numbers. Each e