lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, May 14, 2009 at 1:02 AM, Geoff Leyland
<geoff_leyland@fastmail.fm> wrote:
> seq.map and seq.reduce take an operator as their first argument, and a
> sequence as their second.  seq.filter takes a sequence as its first argument
> and an operator as its second.  Is there a reason for the inconsistency?  I
> see that you can chain filter, but this implies that you can't chain map?

Initially I always had the object before the function, then was
persuaded that canonical map functions put the function first. But
List.map was always an exception, because it was being called as a
method.  seq.map as a standalone function does take the function
first, but seq.map as a method of a sequence wrapper takes it second.
These convolutions are necessary if function is to be the first
explicit argument, whether called as a method or function.

Now  that you point it out, it does seem a wee bit arbitrary, or at
least requiring some extra explanation.

steve d.