lua-users home
lua-l archive

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


Jean-Claude Wippler <jcw@equi4.com> writes:
>>  (1) The "super lightweight so I can stick it in a function call with
>>      an almost trivial expression and it won't look clumsy".  [...]
>>  (2) As a simple way to add new control structures, by using
>>      smalltalk/ruby-like "blocks" to make function calls look sort of
>>      like control-structure.
...
> The second case can be used for more than just control structures.
> Passing predicates to a collection method, for example. In Ruby:
>
> 	mydata.sort { |a,b| a.upcase > b.upcase }
>
> 	mydata.collect { |x| x.shoesize > x.age/2 }
>

Er, perhaps I misunderstand your examples, but those look like precisely
my case (1):

   mydata:sort ( |a,b|(upcase (a) > upcase (b)) )

   mydata:collect ( |x| (x.shoesize > x.age/2) )

-Miles

-- 
"Suppose He doesn't give a shit?  Suppose there is a God but He
just doesn't give a shit?"  [George Carlin]