[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Standard Libraries: (was: and Lua marches on)
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 17 Dec 2009 15:58:27 +0200
On Thu, Dec 17, 2009 at 3:43 PM, Tony Finch <dot@dotat.at> wrote:
> Traditional functional libraries don't have a map2() function since
> it can be trivially defined as something like:
>
> function map2(f,xs,ys)
> return map(f,zip(xs,ys))
> end
>
That makes sense, so really it's zip that's the important one here. We
don't really have tuples so zip({1,2,3},{10,20,30}) would give
{{1,10},{2,20},{3,30}}, so the actual function passed to map() here
would be the composition of f and unpack.
What do you think about going beyond ordered lists, given that we are
likely to want to operate on hashes as well? A useful standard
transform is {a=1,b=2} => {{'a',1},{'b',2}} so it's always possible to
reduce hashes to lists.
steve d.