[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LFM + LFSP = LFE?
On Thu 12 Jun 2003 21:10, Bryn Keller wrote:
> Python:
>
> map(mul, [1,2,3], [1,2,3])
>
>>> map(mul,[1,2,3],[1,2,3])
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name 'mul' is not defined
So you have to write your own mul function to use with map? (sorry I don't
know any Python.)
You could also write both Python's map and and a multiargument
multiplication function in Ruby but it just is not as natural as in Scheme
(same applies to Python if indeed you need to define mul).
> Mind you, I think this example shows more about the flexibility of
> Scheme's map function (which Python's happens to share) than about
> syntax.
>
Yes. But in a message-passing OO language such as Ruby mapping over
multiple arrays simultaneously is just awkward since methods have a single
receiver. Thats why I was wondering about Smalltalk.
--
Grzegorz ChrupaĆa
jabber: grzegorzc@jabber.org
website: http://pithekos.net