Python syntax in Lisp and Scheme
Mark Wilson
mwilson13 at cox.net
Sat Oct 4 15:37:53 EDT 2003
On Saturday, October 4, 2003, at 01:02 PM, Alex Martelli wrote:
> [snip]
> In Ruby, the spaces of methods and data are separate (i.e.,
> most everything is "an object" -- but, differently from
> Python, methods are not objects in Ruby), and I do not
> think, therefore, that you can write a method that builds
> and returns another method, and bind the latter to a name --
> but you can return an object with a .call method, a la:
>
> def outer(a) proc do |b| a+=b end end
>
> x = outer(23)
> puts x.call(100) # emits 123
> puts x.call(100) # emits 223
>
> [i.e., I can't think of any way you could just use x(100)
> at the end of such a snippet in Ruby -- perhaps somebody
> more expert of Ruby than I am can confirm or correct...?]
> [snip]
The response to this question was posted only to ruby-talk and was as
follows:
From: ts <decoux at moulon.inra.fr>
Date: Sat Oct 4, 2003 1:22:58 PM US/Eastern
To: ruby-talk at ruby-lang.org (ruby-talk ML)
Cc: ruby-talk at ruby-lang.org
Subject: Re: Python syntax in Lisp and Scheme
Reply-To: ruby-talk at ruby-lang.org
> "A" == Alex Martelli <aleax at aleax.it> writes:
A> [i.e., I can't think of any way you could just use x(100)
A> at the end of such a snippet in Ruby -- perhaps somebody
A> more expert of Ruby than I am can confirm or correct...?]
Module#define_method
Guy Decoux
Forwarded to python-list by Mark Wilson
More information about the Python-list
mailing list