help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling a function with undefined symbol


From: Michael Heerdegen
Subject: Re: Calling a function with undefined symbol
Date: Wed, 09 Nov 2022 16:59:01 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Sam Steingold <sds@gnu.org> writes:

> > * Michael Heerdegen <zvpunry_urreqrtra@jro.qr> [2022-11-09 00:53:33
> > +0100]:
> >
> > Sam Steingold <sds@gnu.org> writes:
> >
> >> ((lambda (x) `(,x ',x)) (lambda (x) `(,x ',x)))
> >
> >   (#1=(lambda (x) '(#1# '#1#)) #1#)
>
> Nah, (#1=(lambda (x) `(,x ',x)) #1#)

Yes, I was wrong two times: the first time when I posted the wrong
counterpart of the quote-quine.  My version without quoting was a
slightly different thing because evaluation didn't stop.  Your version
fits better.

And (lambda (x) '(#1# '#1#)) is nonsense because it ignores the
argument.

But why not ((lambda (x) `(,x ,x)) (lambda (x) `(,x ,x))) - why do you
quote the second list element?  I guess you want to avoid that the
lambda is evaluated and gets a closure, but then you want

  ((lambda (x) `(,x ',x)) '(lambda (x) `(,x ',x)))

                          ^
> I would rather avoid circular lists _in code_.

I had been wondering about the question: If

  ((lambda (x) `(,x ',x)) (lambda (x) `(,x ',x)))

is the version for n=1 arguments, how would a version for n=0 look like?
Then you could either construct (a) an expression that returns the n=0
counterpart, which is easy, or give (b) an expression that is the
counterpart itself.  Then I think you need circular code because the
function does not receive an argument:

  (#1=(lambda () '(#1#)))


Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]