Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The less time planning, the more time programming.


devel / comp.lang.lisp / Re: Why is `lambda` not a special form

SubjectAuthor
* Why is `lambda` not a special formStefan Monnier
+* Re: Why is `lambda` not a special formSam Steingold
|+* Re: Why is `lambda` not a special formStefan Monnier
||`- Re: Why is `lambda` not a special formSam Steingold
|`- Re: Why is `lambda` not a special formKaz Kylheku
+* Re: Why is `lambda` not a special formKaz Kylheku
|`* Re: Why is `lambda` not a special formStefan Monnier
| +* Re: Why is `lambda` not a special formKaz Kylheku
| |`* Re: Why is `lambda` not a special formStefan Monnier
| | `* Re: Why is `lambda` not a special formKaz Kylheku
| |  `* Re: Why is `lambda` not a special formStefan Monnier
| |   +* Re: Why is `lambda` not a special formMadhu
| |   |+- Re: Why is `lambda` not a special formZyni Moë
| |   |+* Re: Why is `lambda` not a special formStefan Monnier
| |   ||`- Re: Why is `lambda` not a special formMadhu
| |   |`- Re: Why is `lambda` not a special formPo Lu
| |   `* Re: Why is `lambda` not a special formKaz Kylheku
| |    `- Re: Why is `lambda` not a special formStefan Monnier
| `* Re: Why is `lambda` not a special formZyni Moë
|  `* Re: Why is `lambda` not a special formStefan Monnier
|   `* Re: Why is `lambda` not a special formZyni Moë
|    `- Re: Why is `lambda` not a special formStefan Monnier
+* Re: Why is `lambda` not a special formZyni Moë
|`* Re: Why is `lambda` not a special formStefan Monnier
| `* Re: Why is `lambda` not a special formZyni Moë
|  `- Re: Why is `lambda` not a special formStefan Monnier
`* Re: Why is `lambda` not a special formJeff Barnett
 `- Re: Why is `lambda` not a special formStefan Monnier

Pages:12
Re: Why is `lambda` not a special form

<sum3lb$1uv$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16884&group=comp.lang.lisp#16884

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jbb@notatt.com (Jeff Barnett)
Newsgroups: comp.lang.lisp
Subject: Re: Why is `lambda` not a special form
Date: Thu, 17 Feb 2022 11:20:24 -0700
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <sum3lb$1uv$1@dont-email.me>
References: <jwvr184dx1k.fsf-monnier+comp.lang.lisp@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 17 Feb 2022 18:20:27 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="e8c59220d27b40059c0761da6aabca9e";
logging-data="2015"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18EuWo7E2HbgfT+HKnUcy/1ofcfcT2wJXU="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.6.1
Cancel-Lock: sha1:gFiZ8R9Ohkb/vx3B0Q/PHFfZkaU=
In-Reply-To: <jwvr184dx1k.fsf-monnier+comp.lang.lisp@gnu.org>
Content-Language: en-US
 by: Jeff Barnett - Thu, 17 Feb 2022 18:20 UTC

On 2/15/2022 7:35 AM, Stefan Monnier wrote:
> Does someone know of an article or rationale explaining why `lambda` is
> a macro, i.e. why the fully-expanded code needs to be (function (lambda
> ...)) rather than just (lambda ...)?
>
> I can guess its origin as an accident of history, but I think there's
> been enough years between the introduction of #' to fix the accident and
> the design of Common Lisp to have it fixed, so I'm wondering if there
> were other reasons to keep `lambda` as something that's relegated to
> `function` as opposed to being a special-form.
I just noticed this thread and quickly scanned through it, i.e., I may
have missed that what I'm about to say is redundant. If so, apologies in
advance.

I believe that if (lambda ...) is usable everywhere and is considered a
functional constant, than so must be '(lambda ...). However, you can no
more close a quoted lambda in the current lexical context than you can a
variable. Consider (eval 'v) which accesses the global binding of v, not
a v bound locally.

Consider the differences among the following evaluated at runtime from
compiled code:

1 (eval (lambda ...))

2 (eval '(lambda ...))

3 (eval (function (lambda ...)))

Numbers 1 and 2 should return the lambda closed in the global context
while 3 should return the lambda closed in the current lexical
environment. Their is a "natural" desire to have 1 act like 3 but then
you could not claim that 1 is a functional constant. And 2 can't act
like 3 without mutilating what quote means either.

In any event, I think that the rules concerning lambda forms were
imposed to try smoothing the transition to a lexical language (augmented
with dynamic scope too) from older Lisps. There were also issues of
general semantic compatibility with usages of flet and labels that were
all about fitting in to the lexical scope scheme: so

(function (lambda ...)) => (flet((g ...)) (function g)), where g is an
anonymous symbol.

You simply couldn't consistently achieve this effect if the evaluator
(eval or the compiler) couldn't deal with scoping issues at encounter
time as opposed to application time. Quoting or calling (lambda ...) a
constant makes that impossible.
--
Jeff Barnett

Re: Why is `lambda` not a special form

<jwvmtip2vkh.fsf-monnier+comp.lang.lisp@gnu.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16885&group=comp.lang.lisp#16885

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: monnier@iro.umontreal.ca (Stefan Monnier)
Newsgroups: comp.lang.lisp
Subject: Re: Why is `lambda` not a special form
Date: Thu, 17 Feb 2022 13:33:50 -0500
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <jwvmtip2vkh.fsf-monnier+comp.lang.lisp@gnu.org>
References: <jwvr184dx1k.fsf-monnier+comp.lang.lisp@gnu.org>
<sum3lb$1uv$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="bea98adecb175c81622af547f2dcb8a9";
logging-data="9025"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18j5s8HoLimpaLAaWkp8kmH"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
Cancel-Lock: sha1:wbLopsVBbTbi3zaB93k41EaJvXU=
sha1:0TZE4CeL4fiBekWwFpSxduzzbj4=
 by: Stefan Monnier - Thu, 17 Feb 2022 18:33 UTC

> I believe that if (lambda ...) is usable everywhere and is considered
> a functional constant, than so must be '(lambda ...).

I don't see why. Maybe we don't have the same understanding of "usable
everywhere", but my question was about making lambda a special form, so
that would make it usable anywhere a form can be used, but not
literally everywhere, of course.

Stefan

Re: Why is `lambda` not a special form

<sfsf5sez.fsf@yahoo.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16896&group=comp.lang.lisp#16896

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!yBxEwczGqGZRm2Ye9g6etw.user.46.165.242.91.POSTED!not-for-mail
From: luangruo@yahoo.com (Po Lu)
Newsgroups: comp.lang.lisp
Subject: Re: Why is `lambda` not a special form
Date: Sat, 19 Feb 2022 13:36:36 +0800
Organization: Aioe.org NNTP Server
Message-ID: <sfsf5sez.fsf@yahoo.com>
References: <jwvr184dx1k.fsf-monnier+comp.lang.lisp@gnu.org>
<20220215080700.39@kylheku.com>
<jwvmtisc6dr.fsf-monnier+comp.lang.lisp@gnu.org>
<20220215111335.417@kylheku.com>
<jwva6erc2u5.fsf-monnier+comp.lang.lisp@gnu.org>
<20220215122049.254@kylheku.com>
<jwv35kjaiju.fsf-monnier+comp.lang.lisp@gnu.org>
<m3ee4360sy.fsf@leonis4.robolove.meer.net>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: gioia.aioe.org; logging-data="26220"; posting-host="yBxEwczGqGZRm2Ye9g6etw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (haiku)
X-Notice: Filtered by postfilter v. 0.9.2
Cancel-Lock: sha1:nEfqX5puedMiHwiNsr0nAMGdP88=
 by: Po Lu - Sat, 19 Feb 2022 05:36 UTC

Madhu <enometh@meer.net> writes:

> I really detest all the source code changes that you check in to elisp
> sources that change perfectly normal uses of (lambda () ...) to
> #'(lambda () ) just to satisfy your perverted aesthetic.

While I agree that most stylistic changes to otherwise working Elisp
code are unwarranted, I've never seen Stefan make that particular change
before.

And "detest" puts it too strongly.


devel / comp.lang.lisp / Re: Why is `lambda` not a special form

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor