[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Map and filter without intermediate tables
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 7 Jun 2012 13:30:08 +0200
On Thu, Jun 7, 2012 at 1:06 PM, Geoff Leyland <email@example.com> wrote:
> Yes, but if you have a function generating a sequence and a series of sequence processors that might do things like map or filter that sequence, then you might consider avoiding intermediate tables, since there was never a table in the first place.
That was the idea behind pl.seq
> f = stringio.open 'one\n\ntwo\nthree'
But I've never bothered to check the speed - I suppose the thing about
iterators is that they are 'lazy lists', potentially infinite.
> seq(function() return math.random(1,10) end):take(5):printall()
4 9 9 8 2
Personally, I prefer method chaining to functional application, since
my brain tends to work best left-to-right.