[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Penlight Libraries, First release
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 14 May 2009 08:41:29 +0200
On Thu, May 14, 2009 at 5:56 AM, David Manura <dm.lua@math2.org> wrote:
> I don't really like the complicating DWIM stuff in List:map (i.e.
> is_type(arg1,List)):
>
> function List:map (fun,arg1,...)
> local res
> if is_type(arg1,List) then
> res = map2(fun,self,arg1,...)
> else
> res = imap(fun,self,arg1,...)
> end
> return setmetatable(res,List)
> end
>
> e.g. what if someone really wanted to pass a list as arg1 and have it
> operated with imap?
Yes, you are right, and to be consistent this is really two separate
functions, map and map2
To be really safe, we need tablex.imap2, because map2 does iterate
over the hash part of the table as well, leading to odd effects.
steve d.
- References:
- Re: [ANN] Penlight Libraries, First release, steve donovan
- Re: [ANN] Penlight Libraries, First release, David Manura
- Re: [ANN] Penlight Libraries, First release, steve donovan
- Re: [ANN] Penlight Libraries, First release, Mark Hamburg
- Re: [ANN] Penlight Libraries, First release, David Manura
- Re: [ANN] Penlight Libraries, First release, steve donovan
- Re: [ANN] Penlight Libraries, First release, David Manura
- Re: [ANN] Penlight Libraries, First release, steve donovan
- Re: [ANN] Penlight Libraries, First release, David Manura