From: Helmut Eller on
* His kennyness [2010-04-28 21:12+0200] writes:

> Mariano Montone wrote:
>> His kennyness escribi�:
>>> Captain Obvious wrote:
>>>> Z> I'm new to functional programming, just barely getting the hang of it,
>>>> Z> I hope.
>>>>
>>>> I'm sorry to disappoint you, but Lisp is not really a functional
>>>> programming language.
>>>> But it supports functional programming to some extent, ok...
>>> God, you are worse than I thought. Could you just go away or shut up for
>>> ten years and learn something before speaking here again?
>>>
>>> In Lisp, every form returns a value. Case closed. Thank you for playing.
>>>
>>> kt
>>
>> CL-USER> (defun foo ()
>> (values))
>> FOO
>> CL-USER> (foo)
>> ; No value
>> CL-USER>
>
>
> I can always count on some newsgroup genius to point out the one
> non-exception exception. It is a non-exception because there /is/ a
> value if you are looking for one, namely nil. "; No value" is just a
> choice of the author of your repl. My repl's author simply shows a new
> prompt, which gets the edge for elegance in my book.

(multiple-value-call (lambda (x) x) (values))

Is definitely an error.

Helmut
From: RG on
In article <m2zl0n1cb2.fsf(a)gmail.com>,
Helmut Eller <eller.helmut(a)gmail.com> wrote:

> * His kennyness [2010-04-28 21:12+0200] writes:
>
> > Mariano Montone wrote:
> >> His kennyness escribió:
> >>> Captain Obvious wrote:
> >>>> Z> I'm new to functional programming, just barely getting the hang of it,
> >>>> Z> I hope.
> >>>>
> >>>> I'm sorry to disappoint you, but Lisp is not really a functional
> >>>> programming language.
> >>>> But it supports functional programming to some extent, ok...
> >>> God, you are worse than I thought. Could you just go away or shut up for
> >>> ten years and learn something before speaking here again?
> >>>
> >>> In Lisp, every form returns a value. Case closed. Thank you for playing.
> >>>
> >>> kt
> >>
> >> CL-USER> (defun foo ()
> >> (values))
> >> FOO
> >> CL-USER> (foo)
> >> ; No value
> >> CL-USER>
> >
> >
> > I can always count on some newsgroup genius to point out the one
> > non-exception exception. It is a non-exception because there /is/ a
> > value if you are looking for one, namely nil. "; No value" is just a
> > choice of the author of your repl. My repl's author simply shows a new
> > prompt, which gets the edge for elegance in my book.
>
> (multiple-value-call (lambda (x) x) (values))
>
> Is definitely an error.
>
> Helmut

Sigh. I hate it when smug lisp weenies get things wrong. Makes it hard
to clean up the mess.

Lisp is not considered functional because every form returns a value.
First, it is clearly not true that every form returns a value. You
don't even need to introduce the ambiguous case of (values). There are
many forms in CL that don't return anything, notably GO, THROW, and
ERROR.

The reason Lisp is considered a functional language is that it has
lexical closures as first-class data structures. That's really all you
need to do functional programming. It also has two additional features
that are generally considered part and parcel of functional programming:
linked lists and conditional expressions. But these don'y actually add
and real functionality since they can be built out of closures.

Everything else is a red herring.

rg
From: Scott L. Burson on
On Apr 28, 6:28 pm, RG <rNOSPA...(a)flownet.com> wrote:
>
> The reason Lisp is considered a functional language is that it has
> lexical closures as first-class data structures.  That's really all you
> need to do functional programming.

That's strictly true, but a functional data structures library can
sure be handy!

http://common-lisp.net/project/fset/

-- Scott
From: Captain Obvious on
Hk> In Lisp, every form returns a value.

What does GO return? And, importantly, WHERE does it return?

Hk> God, you are worse than I thought. Could you just go away or shut up
Hk> for ten years and learn something before speaking here again?

Aha, come back when you learn about non-local control transfers.
From: Captain Obvious on
R> The reason Lisp is considered a functional language is that it has
R> lexical closures as first-class data structures.

A bit of problem here is that most modern programming languages have them.
Python and JavaScript always had them.
They were added relatively recently into C#, PHP, Delphi.
There are proposals to add them into Java and C++.

Should we consider all these languages functional? I don't think so. That
would be totally meaningless.

R> That's really all you need to do functional programming.

Well, ok, you can do functional programming in all those languages I've
listed above.
But another question is -- do you want to? Is that a preferred style?