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


On Thu 12 Jun 2003 18:42, Bruce Lewis wrote:
> 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!

First of all let me clarify that *I*, too, happen to prefer Scheme syntax 
to Ruby's. But we are the minority, for some reason.

> 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))

No easy way of doing this that I know of (is there in Smalltalk?). 
Thing is Ruby is mainly an OO language and although it loses to Scheme in 
this particular case and other similar uses, it wins in other areas. I can 
Whereas in Scheme I have to remember about length, string-length, 
vector-length and my-favourite-collection-length.

But let's not start yet another language war. The motivation of my msg was 
not to advocate Ruby over Scheme but to point out a possible LFE, as 
suggested by the OP.

Another, perhaps less obvious candidate that has just occured to me could 
be Java/Ecmascript. For what I've seen of it, it seemed to have some quite 
powerful features hidden behind a mainstream, rigid syntax.

Grzegorz Chrupała
jabber: grzegorzc@jabber.org
website: http://pithekos.net