[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LFM + LFSP = LFE?
Bruce Lewis <brlewis@alum.mit.edu> writes:
> Grzegorz ChrupaĆa <grzegorz@pithekos.net> writes:
>
>> On Thu 12 Jun 2003 03:40, Michael Vanier wrote:
>> > Note that one of the common features of many of these languages is that
>> > they provide lisp-like power with a friendlier syntax.
>>
>> True of Ruby, too. Instead of:
>> (map (lambda (n) (* n 2)) '(0 1 2 3 4))
>> You write:
>> [0,1,2,3,4].map{|n| n*2}
>
> Great! Now people afraid of "()'" can use "[],.{}|" instead!
>
> Hopefully quick question that will help us Scheme afficianados
> understand this friendliness better:
>
> What's the Ruby equivalent of this?
>
> (map * '(1 2 3) '(4 5 6))
Well, the Perl 6 equivalent will be:
[1,2,3] >>*<< [4,5,6]
Not sure how you'd write Array.map to do the right thing in Ruby, but I'm sure it wouldn't be too hard.
--
Piers