unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Another question about lambdas
Date: Sat, 10 Dec 2022 21:29:29 +0100	[thread overview]
Message-ID: <87cz8rypcm.fsf@web.de> (raw)
In-Reply-To: Y5Te/7XAnvK7RcDA@tuxteam.de

<tomas@tuxteam.de> writes:

> On Sat, Dec 10, 2022 at 06:23:38PM +0100, Michael Heerdegen wrote:
> > Hello,
> > 
> > My new question for today is:
> > 
> > What's the result of the following expression - and why?  Or maybe it is
> > invalid?
> > 
> > #+begin_src emacs-lisp
> >   (let* ((x 'l)
> >          (f (lambda () x))
> >          (x 'd))
> >     (funcall f))
> > #+end_src
>
> I had to look that up in the elisp manual, and I must admit
> I didn't find it very clear, but ultimately it says what will
> happen.

The shadowing is only one aspect of the exercise.  The question of the
return value is still not trivial.

> Scheme docs are typically clearer, by explaining (let* ...) in
> terms of nested (let ...). Perhaps that should go into the
> Elisp manual, what do people think?

+1.

I've skimmed over (info "(elisp) Local Variables").  Saying that `let*' is
equivalent to nested `let's would be helpful to understand the matter.

OTOH, shadowing is explained quite well.

Another thing that should be changed on that page is that it (still) says
that "The default scoping rule in Emacs Lisp is called “dynamic
scoping”" - that's not really true any more since *scratch* defaults to
lexical scoping.

Michael.




  reply	other threads:[~2022-12-10 20:29 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-10 17:23 Another question about lambdas Michael Heerdegen
2022-12-10 19:33 ` tomas
2022-12-10 20:29   ` Michael Heerdegen [this message]
2022-12-10 20:03 ` Emanuel Berg
2022-12-12  1:50   ` Michael Heerdegen
2023-01-18 11:52     ` Emanuel Berg
2023-01-19 13:23       ` Michael Heerdegen
2022-12-10 21:58 ` Arash Esbati
2022-12-11  0:00   ` Michael Heerdegen
2022-12-11  0:09     ` Michael Heerdegen
2022-12-11  7:02     ` tomas
2022-12-12  1:56       ` Michael Heerdegen
2022-12-12  5:24         ` tomas
2022-12-12  6:22           ` Michael Heerdegen
2023-01-18 11:51             ` Emanuel Berg
2023-01-19 13:24               ` Michael Heerdegen
2023-01-19 13:38               ` Michael Heerdegen
2023-01-30 17:44                 ` Emanuel Berg
2023-02-03  0:20                   ` Michael Heerdegen
2023-02-25  7:31                     ` Emanuel Berg
2023-02-27  8:28                       ` tomas
2023-01-18 11:47           ` Emanuel Berg
2023-01-18 11:33         ` Emanuel Berg
2023-01-19 13:32           ` Michael Heerdegen
2022-12-13 11:26     ` Arash Esbati
2022-12-14  2:22       ` Michael Heerdegen
2022-12-11  0:13 ` Gregory Heytings
2022-12-11  0:38   ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cz8rypcm.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).