Robert Klemme
9/1/2006 12:53:00 PM
On 01.09.2006 11:26, Jeremy Tregunna wrote:
>
> On 06-09-01, at 04:10, Robert Klemme wrote:
>
>> On 01.09.2006 09:23, Jeremy Tregunna wrote:
>>> On 06-09-01, at 02:45, femto gary wrote:
>>>> hello all, Can I see method source code,
>>>> like in javascript, when you generate a function,
>>>> you can call to_string on it to see its source code.
>>>> It's especailly useful when you examine other's code
>>>> or dynamic generating func/method.
>>> No, there are only a few languages I can think of (okay, 2) that
>>> allow this: the aforementioned javascript, and Io; Ruby does not.
>>
>> Just out of curiosity: what about Lisp?
>
> I don't know of a single lisp implementation that lets you do this,
> perhaps you could enlighten me?
<disclaimer>No LISP guru here</disclaimer>
I probably confused lambdas with normal functions:
[1]> (setq f1 (lambda (x) (+ x x)))
#<FUNCTION :LAMBDA (X) (+ X X)>
[2]> (funcall f1 10)
20
[3]> f1
#<FUNCTION :LAMBDA (X) (+ X X)>
So, for a lambda you can - but apparently for functions you can't. Or
can you?
Kind regards
robert