[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Standard Libraries: (was: and Lua marches on)
- From: David Manura <dm.lua@...>
- Date: Thu, 24 Dec 2009 00:42:58 -0500
On Mon, Dec 21, 2009 at 3:39 AM, steve donovan wrote:
> If I could assume that |x,y| x..y was universal, then we would not
> need such fallbacks....
> We all agree that map() is an important function which needs to be in
> the standard toolkit. But the verbosity of anonymous functions where
> the payload is a simple operation makes it less appealing, ...
> E.g. Penlight allows placeholder expressions to be used as callables:...
>> tablex.map2(_1+_2,{1,2,3},{10,20,30})
These are both terse and avoid implementing exceptional rules in the
map function:
table.imap(op'..', {'a','b'},{'1','2'})
tablex.map2(I(_1+_2),{1,2,3},{10,20,30})
Isn't that sufficient? Supporting table.imap('..',
{'a','b'},{'1','2'}) would cause an ambiguity if someone makes strings
callable by setting the call operator on the string metatable. Also,
tablex.map2(_1+_2,{1,2,3},{10,20,30}) could be interpreted as
function(a,b) return tablex.map2(a+b, {1,2,3},{10,20,30}) .
- References:
- Standard Libraries: (was: and Lua marches on), steve donovan
- Re: Standard Libraries: (was: and Lua marches on), steve donovan
- Re: Standard Libraries: (was: and Lua marches on), steve donovan
- Re: Standard Libraries: (was: and Lua marches on), Tony Finch
- Re: Standard Libraries: (was: and Lua marches on), Fabien
- Re: Standard Libraries: (was: and Lua marches on), steve donovan
- Re: Standard Libraries: (was: and Lua marches on), steve donovan
- Re: Standard Libraries: (was: and Lua marches on), steve donovan
- Re: Standard Libraries: (was: and Lua marches on), Fabien
- Re: Standard Libraries: (was: and Lua marches on), steve donovan