From: Andreas Eder on
Hi Xah,

>>>>> "Xah" == Xah Lee <xahlee(a)gmail.com> writes:

Xah> using local variable is fine. In lisp, it's like this:

Xah> (let (var1 var2 ...)
Xah> (setq var1 val1)
Xah> (setq var2 val2)
Xah> ...
Xah> body
Xah> )

You can do this easier and more succintly in the following way:

(let ((var1 val1) (var2 val2) ...)
...
body)

'Andreas

--
ceterum censeo redmondinem esse delendam.
From: Captain Obvious on
DV> I also find particularly annoying when people assume that functional =
DV> purely functional. That's the kind of vocabulary fuzziness that leads
DV> to comments I've heard too often like:

Usually people who mention functional programming want to juxtapose it to
imperative programming.
If your definition of functional programming language includes CL and JS,
that's not juxtaposition at all.
So your definition destroys meaning. Term "functional language" becomes
unusable, but maybe if it pleases lispers so they know that they still use
functional programming language it's ok?

It doesn't need to be 100% pure functional, but I think it should have at
least some support for immutable data structures to qualify as functional.

DV> <Haskell guy>:
DV> Lisp? Ah yeah, that's this weird imperative language with lots of
DV> parens...

Well, I guess I'm more like a Haskell guy on this, except that I'm
programming mostly in CL. But I know a bit of Haskell, and I see that there
is an abyss between them.

From: Tim Bradshaw on
On 2010-04-29 16:42:18 +0100, RG said:

> You know, Kenny, the arrogant Lisp weenie act would go over a lot better
> if you actually knew what you're talking about.
>
> ? (defun foo () (values))
> FOO
> ? (defun baz () (multiple-value-call (lambda (x) x) (foo)))
> BAZ
> ? (baz)
>> Error:

THis is not really any different to

(defun foo (x y)
(cons x y))

(foo 1)

From: RG on
In article <hre79f$ul2$1(a)news.eternal-september.org>,
Tim Bradshaw <tfb(a)tfeb.org> wrote:

> On 2010-04-29 16:42:18 +0100, RG said:
>
> > You know, Kenny, the arrogant Lisp weenie act would go over a lot better
> > if you actually knew what you're talking about.
> >
> > ? (defun foo () (values))
> > FOO
> > ? (defun baz () (multiple-value-call (lambda (x) x) (foo)))
> > BAZ
> > ? (baz)
> >> Error:
>
> THis is not really any different to
>
> (defun foo (x y)
> (cons x y))
>
> (foo 1)

Good grief, I'm surrounded by idiots. Of course it's different. Here
you're calling a function of two arguments with one argument. That has
nothing to do with whether or not (values) "really" returns NIL as Kenny
claimed. It doesn't. What does happen is that CL implicitly "expands"
zero values to NIL in some contexts -- but not all. And in particular,
not in the context of multiple-value-call. And this has nothing to do
with any compile-time optimizations, as Kenny also incorrectly claimed.

? (defun zero-values () (values))
ZERO-VALUES
? (defun tim () (cons (zero-values) (zero-values)))
TIM
? (defun kenny () (multiple-value-call 'cons (zero-values)
(zero-values)))
KENNY
? (tim)
(NIL)
? (kenny)
> Error: Too few arguments in call to #<Compiled-function CONS #x3000000D771F>:

And if that doesn't convince you:

? (defun maybe-zero-values (x) (if x (values)
'kenny-is-a-smug-lisp-weenie))
MAYBE-ZERO-VALUES
? (defun kenny2 (x) (multiple-value-call 'cons (maybe-zero-values x)
(maybe-zero-values x)))
KENNY2
? (kenny2 nil)
(KENNY-IS-A-SMUG-LISP-WEENIE . KENNY-IS-A-SMUG-LISP-WEENIE)
? (kenny2 t)
> Error: Too few arguments in call to #<Compiled-function CONS #x3000000D771F>:

rg
From: RG on
In article <4bda8817$0$280$14726298(a)news.sunsite.dk>,
"Captain Obvious" <udodenko(a)users.sourceforge.net> wrote:

> DV> I also find particularly annoying when people assume that functional =
> DV> purely functional. That's the kind of vocabulary fuzziness that leads
> DV> to comments I've heard too often like:
>
> Usually people who mention functional programming want to juxtapose it to
> imperative programming.

Usually people who mention "data" want to distinguish it from "code".
That does not change the fact that code and data are fundamentally
indistinguishable, nor does it change the fact that artificial
constraints can be imposed to make them distinguishable, nor does that
change the fact that imposing such artificial constraints is generally
considered a bad idea here on C.L.L. What people usually want ought not
be confused with actual facts.

> If your definition of functional programming language includes CL and JS,
> that's not juxtaposition at all.
> So your definition destroys meaning. Term "functional language" becomes
> unusable, but maybe if it pleases lispers so they know that they still use
> functional programming language it's ok?
>
> It doesn't need to be 100% pure functional, but I think it should have at
> least some support for immutable data structures to qualify as functional.

Lisp can "provide some support for immutable data structures" by doing,
e.g.:

(shadow '(rplaca rplacd setf))

It doesn't seem to me that your definition is exactly a model of
semantic clarity.

rg