Logan Capaldo <logancapaldo / gmail.com> writes:

> On Jun 12, 2006, at 2:58 PM, Matthew Smillie wrote:
>
>> On Jun 12, 2006, at 18:06, Christian Neukirchen wrote:
>>
>>> it's important to recognize that Scheme has
>>> true first-class functions (being a Lisp-1), whereas there is a
>>> fundamental difference between Blocks/Procs/lambdas and methods
>>> (being
>>> a Lisp-2).
>>
>> This has slightly confused me, but I'll admit that it's been a
>> while since I've dealt with this sort of thing, so jump in with
>> corrections as required.
>>
>>   - A language has first-class functions when a function can be
>> assigned to variable, passed to or returned from another function,
>> and so on.  In Ruby, a = lambda { |x| x + 1 } for example.
>>
>>   - The distinction between Lisp-1 and Lisp-2 that the latter has a
>> separate namespace for functions, in Ruby, for example, def a(x) x
>> + 1; end can exist alongside a = lambda { |x| x + 1 } (and there's
>> a corresponding hoop to jump through to call the lambda).
>>
>> What I don't understand is how it follows that being in a different
>> namespace implies that Lisp-2 doesn't have true first-class
>> functions.  The only reason I can think of is the circular one that
>> "only Lisp-1 has true first-class functions", which gives it the
>> distinct flavour of an age-old Lisp holy war (if that's the case,
>> consider me uninterested).
>>
>> matthew smillie.
>>
>
> In a Lisp-2 you have to use special syntax (funcall, apply, #call) to
> call a function-value. I believe that was the distinction he was
> making.

Exactly.  If there are two different syntaxes for a) method calling,
and b) calling of "first-class" code objects ("functions"), these
functions are a) either are not really first-class or b) not functions
in the usual meaning of the term.

I could also say: Ruby has first-class lambdas (which *wrap* a block
or a method), but not first-class methods (or blocks, for that
matter).  In Scheme, all executable code objects are first-class.

In real life, it's probably not that important; but from the language
aspect, it's rather characterizing.  (E.g. python has first-class
functions and first-class methods (which are functions, too)).

-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org