* Calling a function with undefined symbol @ 2022-10-31 8:15 Heime 2022-10-31 8:32 ` Jean Abou Samra ` (2 more replies) 0 siblings, 3 replies; 46+ messages in thread From: Heime @ 2022-10-31 8:15 UTC (permalink / raw) To: Heime via Users list for the GNU Emacs text editor Have written a function named "mbcomplt" that takes a symbol. (defun mbcomplt (sgnl) "DOC." (if (eq sgnl 'go) (message "go") (message "nogo"))) I can call this function with (mbcomplt 'go) This even though the symbol "'go" does not exist. What is happening here? My understanding about symbols is that I can make a symbol using (defvar seqr 3) ; set symbol seqr with value 3 (setq seqr 5) ; set symbol seqr with value 5 (symbol-value 'seqr) ; get value of symbol (returns 5) (symbol-name 'seqr) ; get name of symbol (returns "seqr") ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-10-31 8:15 Calling a function with undefined symbol Heime @ 2022-10-31 8:32 ` Jean Abou Samra 2022-10-31 8:42 ` tomas 2022-10-31 11:34 ` Emanuel Berg 2 siblings, 0 replies; 46+ messages in thread From: Jean Abou Samra @ 2022-10-31 8:32 UTC (permalink / raw) To: Heime, Heime via Users list for the GNU Emacs text editor Le 31/10/2022 à 09:15, Heime a écrit : > Have written a function named "mbcomplt" that takes a symbol. > > (defun mbcomplt (sgnl) > "DOC." > > (if (eq sgnl 'go) > (message "go") > (message "nogo"))) > > I can call this function with > > (mbcomplt 'go) > > This even though the symbol "'go" does not exist. What is happening here? > > My understanding about symbols is that I can make a symbol using > > (defvar seqr 3) ; set symbol seqr with value 3 > (setq seqr 5) ; set symbol seqr with value 5 > > (symbol-value 'seqr) ; get value of symbol (returns 5) > (symbol-name 'seqr) ; get name of symbol (returns "seqr") It may be helpful to view symbols as some kind of modified strings. The symbol 'go is an amorphous object, just a name for something. You can use it as a name, or as a discrete key, or whatever. You can also "define" it, or rather define a variable with its name, and then you are able to use symbol-value on it, but the symbol object itself is a *potential* name and does not need to have a variable with its name defined in order to be used. Jean ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-10-31 8:15 Calling a function with undefined symbol Heime 2022-10-31 8:32 ` Jean Abou Samra @ 2022-10-31 8:42 ` tomas 2022-10-31 8:57 ` Heime 2022-10-31 12:29 ` Stefan Monnier via Users list for the GNU Emacs text editor 2022-10-31 11:34 ` Emanuel Berg 2 siblings, 2 replies; 46+ messages in thread From: tomas @ 2022-10-31 8:42 UTC (permalink / raw) To: help-gnu-emacs [-- Attachment #1: Type: text/plain, Size: 1591 bytes --] On Mon, Oct 31, 2022 at 08:15:32AM +0000, Heime wrote: > > Have written a function named "mbcomplt" that takes a symbol. The function takes an argument, that's what it does. > (defun mbcomplt (sgnl) > "DOC." sgnl here is a variable. Or a variable name. Depending on how you look at it. > (if (eq sgnl 'go) > (message "go") > (message "nogo"))) Now you are comparing sgnl's /value/ to something (which happens to be a symbol). > I can call this function with > > (mbcomplt 'go) Yes. You could call it also with (mbcomplt 23). Or (mbcomplt "This is not a pipe"). So? > This even though the symbol "'go" does not exist. What is happening here? As soon as you do 'go, the symbol exists. > My understanding about symbols is that I can make a symbol using > > (defvar seqr 3) ; set symbol seqr with value 3 No, no. You are making a variable. Which is a binding of a symbol to a value. > (setq seqr 5) ; set symbol seqr with value 5 No, you set the variable's value to 5. The symbol is not "set" to anything. It is an immutable thing, as far as Lisp is concerned. The symbol 'seqr is just taking the job of variable name here. Like you are called Heime (or whatever it is this week). That name is not you. > (symbol-value 'seqr) ; get value of symbol (returns 5) > (symbol-name 'seqr) ; get name of symbol (returns "seqr") Symbol-value returns the value associated to the symbol. The association itself is called a "variable". Please go re-read the manuals. You have got all of it confused :) Cheers -- t [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-10-31 8:42 ` tomas @ 2022-10-31 8:57 ` Heime 2022-10-31 9:07 ` tomas 2022-10-31 9:24 ` Jean Abou Samra 2022-10-31 12:29 ` Stefan Monnier via Users list for the GNU Emacs text editor 1 sibling, 2 replies; 46+ messages in thread From: Heime @ 2022-10-31 8:57 UTC (permalink / raw) To: tomas; +Cc: help-gnu-emacs ------- Original Message ------- On Monday, October 31st, 2022 at 8:42 AM, <tomas@tuxteam.de> wrote: > On Mon, Oct 31, 2022 at 08:15:32AM +0000, Heime wrote: > > > Have written a function named "mbcomplt" that takes a symbol. > > > The function takes an argument, that's what it does. > > > (defun mbcomplt (sgnl) > > "DOC." > > > sgnl here is a variable. Or a variable name. Depending on how > you look at it. > > > (if (eq sgnl 'go) > > (message "go") > > (message "nogo"))) > > > Now you are comparing sgnl's /value/ to something (which happens > to be a symbol). > > > I can call this function with > > > > (mbcomplt 'go) > > > Yes. You could call it also with (mbcomplt 23). Or (mbcomplt "This is not a pipe"). > So? > > > This even though the symbol "'go" does not exist. What is happening here? > > > As soon as you do 'go, the symbol exists. > > > My understanding about symbols is that I can make a symbol using > > > > (defvar seqr 3) ; set symbol seqr with value 3 > > > No, no. You are making a variable. Which is a binding of a symbol > to a value. Ok, I make a variable. What happens after that? A symbol 'seqr is made too? > > (setq seqr 5) ; set symbol seqr with value 5 > > > No, you set the variable's value to 5. The symbol is not "set" to > anything. It is an immutable thing, as far as Lisp is concerned. Then, how is it that (symbol-value 'seqr) returns 5? There seems to be a symbol and symbol-value returns 5. > The symbol 'seqr is just taking the job of variable name here. > Like you are called Heime (or whatever it is this week). That > name is not you. > > > (symbol-value 'seqr) ; get value of symbol (returns 5) > > (symbol-name 'seqr) ; get name of symbol (returns "seqr") > > > Symbol-value returns the value associated to the symbol. The > association itself is called a "variable". > > Please go re-read the manuals. You have got all of it confused :) Yes, I have got really confused about what symbols are exactly. Even after reading several times. I have never seen anybody make a symbol, only variables. So, what is a symbol? ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-10-31 8:57 ` Heime @ 2022-10-31 9:07 ` tomas 2022-10-31 9:24 ` Jean Abou Samra 1 sibling, 0 replies; 46+ messages in thread From: tomas @ 2022-10-31 9:07 UTC (permalink / raw) To: Heime; +Cc: help-gnu-emacs [-- Attachment #1: Type: text/plain, Size: 1023 bytes --] On Mon, Oct 31, 2022 at 08:57:09AM +0000, Heime wrote: > ------- Original Message ------- > On Monday, October 31st, 2022 at 8:42 AM, <tomas@tuxteam.de> wrote: [...] > Then, how is it that (symbol-value 'seqr) returns 5? There seems to be > a symbol and symbol-value returns 5. Please: read the docs yourself. Others can't do that for you. Specifically "12.7 Accessing Variable Values" in the Emacs Lisp manual. That a "symbol" has a "value" is just a shorthand notation for "a symbol" has "a value" associated to it via a variable. It can also have other things associated to it (a function, for example, also a property list). But it needn't, it can just exist on its own. > Yes, I have got really confused about what symbols are exactly. Even > after reading several times. I have never seen anybody make a symbol, > only variables. So, what is a symbol? 'foo (spedifically this coaxes the reader into creating one. The function behind that is intern. See there. Cheers -- t [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-10-31 8:57 ` Heime 2022-10-31 9:07 ` tomas @ 2022-10-31 9:24 ` Jean Abou Samra 2022-10-31 9:43 ` Heime 1 sibling, 1 reply; 46+ messages in thread From: Jean Abou Samra @ 2022-10-31 9:24 UTC (permalink / raw) To: Heime; +Cc: tomas, help-gnu-emacs > Le 31 oct. 2022 à 09:59, Heime <heimeborgia@protonmail.com> a écrit : > > Yes, I have got really confused about what symbols are exactly. Even > after reading several times. I have never seen anybody make a symbol, > only variables. So, what is a symbol? Imagine parents who are planning to have a child and decide they will call it, say Deborah. They will say things like “I like the name Deborah better than Mary”. Those are sentences about the names themselves, not some children. The names don’t need children in order to exist as words. Then, the child is born and sentences like “Deborah weighs 3kg” (referring to the child named Deborah) start to make sense. When you do 'symbol in Lisp, this gives you a bare name, or a “symbol”. With symbol-value, you get what value is associated with this symbol, if any (the child with that name). But you don’t need a value bound to the symbol (a child called Deborah) before you start using the symbol itself (the name “Deborah”). ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-10-31 9:24 ` Jean Abou Samra @ 2022-10-31 9:43 ` Heime 2022-10-31 9:58 ` Jean Abou Samra 0 siblings, 1 reply; 46+ messages in thread From: Heime @ 2022-10-31 9:43 UTC (permalink / raw) To: Jean Abou Samra; +Cc: tomas, help-gnu-emacs ------- Original Message ------- On Monday, October 31st, 2022 at 9:24 AM, Jean Abou Samra <jean@abou-samra.fr> wrote: > > Le 31 oct. 2022 à 09:59, Heime heimeborgia@protonmail.com a écrit : > > > > Yes, I have got really confused about what symbols are exactly. Even > > after reading several times. I have never seen anybody make a symbol, > > only variables. So, what is a symbol? > > > > > Imagine parents who are planning to have a child and decide they will call it, say Deborah. They will say things like “I like the name Deborah better than Mary”. Those are sentences about the names themselves, not some children. The names don’t need children in order to exist as words. Then, the child is born and sentences like “Deborah weighs 3kg” (referring to the child named Deborah) start to make sense. > > When you do 'symbol in Lisp, this gives you a bare name, or a “symbol”. With symbol-value, you get what value is associated with this symbol, if any (the child with that name). But you don’t need a value bound to the symbol (a child called Deborah) before you start using the symbol itself (the name “Deborah”). The Lisp manual says that a symbol is an object with a name. Then a variable (setq thevar 4) has an associated symbol 'thevar. And the function "(defun thefun ()" also has an associated symbol "'thefun". Furthermore one can make just a symbol, let us say 'go, which can be passed as an argument to a function "(defun mbcomplt (arg)" using (mbcomplt 'go). Then inside the function on can test whether the symbol exists with (eq arg 'go). Even though we only have a name without a values. Is this a good basic understanding of a symbol? ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-10-31 9:43 ` Heime @ 2022-10-31 9:58 ` Jean Abou Samra 2022-10-31 10:57 ` Heime 2022-10-31 17:00 ` [External] : " Drew Adams 0 siblings, 2 replies; 46+ messages in thread From: Jean Abou Samra @ 2022-10-31 9:58 UTC (permalink / raw) To: Heime; +Cc: tomas, help-gnu-emacs > Le 31 oct. 2022 à 10:45, Heime <heimeborgia@protonmail.com> a écrit : > > > ------- Original Message ------- > On Monday, October 31st, 2022 at 9:24 AM, Jean Abou Samra <jean@abou-samra.fr> wrote: > > >>>> Le 31 oct. 2022 à 09:59, Heime heimeborgia@protonmail.com a écrit : >>> >>> Yes, I have got really confused about what symbols are exactly. Even >>> after reading several times. I have never seen anybody make a symbol, >>> only variables. So, what is a symbol? >> >> >> >> >> Imagine parents who are planning to have a child and decide they will call it, say Deborah. They will say things like “I like the name Deborah better than Mary”. Those are sentences about the names themselves, not some children. The names don’t need children in order to exist as words. Then, the child is born and sentences like “Deborah weighs 3kg” (referring to the child named Deborah) start to make sense. >> >> When you do 'symbol in Lisp, this gives you a bare name, or a “symbol”. With symbol-value, you get what value is associated with this symbol, if any (the child with that name). But you don’t need a value bound to the symbol (a child called Deborah) before you start using the symbol itself (the name “Deborah”). > > The Lisp manual says that a symbol is an object with a name. This can be interpreted as the correct definition, but also as a wrong definition where a symbol is necessarily associated with a defined variable. Better said: a symbol is an object that represents a name. > Then a variable (setq thevar 4) has an associated symbol 'thevar. > And the function "(defun thefun ()" also has an associated symbol "'thefun". Furthermore one can make just a symbol, let us say 'go, > which can be passed as an argument to a function "(defun mbcomplt (arg)" using (mbcomplt 'go). Yes. The symbol is an object like any other (5, "foo", whatever), so what you can do with an object, you can do with a symbol, including passing it as an argument to a function. > Then inside the function on can test > whether the symbol exists with (eq arg 'go). That is not testing whether the symbol “exists”. It is testing whether arg is the symbol 'go. > Even though we only have a name without a values. Is this a good basic understanding > of a symbol? Apart from the last part, yes. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-10-31 9:58 ` Jean Abou Samra @ 2022-10-31 10:57 ` Heime 2022-10-31 17:00 ` [External] : " Drew Adams 1 sibling, 0 replies; 46+ messages in thread From: Heime @ 2022-10-31 10:57 UTC (permalink / raw) To: Jean Abou Samra; +Cc: tomas, help-gnu-emacs ------- Original Message ------- On Monday, October 31st, 2022 at 9:58 AM, Jean Abou Samra <jean@abou-samra.fr> wrote: > > Le 31 oct. 2022 à 10:45, Heime heimeborgia@protonmail.com a écrit : > > > > ------- Original Message ------- > > On Monday, October 31st, 2022 at 9:24 AM, Jean Abou Samra jean@abou-samra.fr wrote: > > > > > > > Le 31 oct. 2022 à 09:59, Heime heimeborgia@protonmail.com a écrit : > > > > > > > > Yes, I have got really confused about what symbols are exactly. Even > > > > after reading several times. I have never seen anybody make a symbol, > > > > only variables. So, what is a symbol? > > > > > > Imagine parents who are planning to have a child and decide they will call it, say Deborah. They will say things like “I like the name Deborah better than Mary”. Those are sentences about the names themselves, not some children. The names don’t need children in order to exist as words. Then, the child is born and sentences like “Deborah weighs 3kg” (referring to the child named Deborah) start to make sense. > > > > > > When you do 'symbol in Lisp, this gives you a bare name, or a “symbol”. With symbol-value, you get what value is associated with this symbol, if any (the child with that name). But you don’t need a value bound to the symbol (a child called Deborah) before you start using the symbol itself (the name “Deborah”). > > > > The Lisp manual says that a symbol is an object with a name. > > > > This can be interpreted as the correct definition, but also as a wrong definition where a symbol is necessarily associated with a defined variable. Better said: a symbol is an object that represents a name. > > > Then a variable (setq thevar 4) has an associated symbol 'thevar. > > And the function "(defun thefun ()" also has an associated symbol "'thefun". Furthermore one can make just a symbol, let us say 'go, > > which can be passed as an argument to a function "(defun mbcomplt (arg)" using (mbcomplt 'go). > > > > Yes. The symbol is an object like any other (5, "foo", whatever), so what you can do with an object, you can do with a symbol, including passing it as an argument to a function. > > > Then inside the function on can test > > whether the symbol exists with (eq arg 'go). > > > > That is not testing whether the symbol “exists”. It is testing whether arg is the symbol 'go. Thank you for the clarification. I now understand it. > > Even though we only have a name without a values. Is this a good basic understanding > > of a symbol? > > > > Apart from the last part, yes. Great, thank you. ^ permalink raw reply [flat|nested] 46+ messages in thread
* RE: [External] : Re: Calling a function with undefined symbol 2022-10-31 9:58 ` Jean Abou Samra 2022-10-31 10:57 ` Heime @ 2022-10-31 17:00 ` Drew Adams 2022-10-31 17:10 ` Emanuel Berg 1 sibling, 1 reply; 46+ messages in thread From: Drew Adams @ 2022-10-31 17:00 UTC (permalink / raw) To: Jean Abou Samra, Heime; +Cc: tomas@tuxteam.de, help-gnu-emacs@gnu.org > > The Lisp manual says that a symbol is an object with a name. > > This can be interpreted as the correct definition, but also as a wrong > definition where a symbol is necessarily associated with a defined > variable. Better said: a symbol is an object that represents a name. Not really. A symbol can "represent" any number of things, (including a name, or multiple names - of anything) - whatever you like. But a symbol normally _has_ a name, as one of its properties. OP: Function `make-symbol' requires a name, to create a symbol. Function `symbol-name' returns the name of a symbol. A symbol is indeed a Lisp object - an atom that has a name and possibly other properties (value as a variable, function definition,...). The very first sentence of the Elisp chapter about Symbols says this: A “symbol” is an object with a unique name. And node Symbol Components tells you this: The print name cell _always_ holds a string, and cannot be changed. The print name cell holds the string that is the name of a symbol. Since symbols are represented textually by their names, it is important not to have two symbols with the same name.[*] Node Creating and Interning Symbols tells you: When the Lisp reader encounters a symbol, it reads all the characters of the name.... If a symbol with the desired name is found, the reader uses that symbol. If the obarray does not contain a symbol with that name, the reader makes a new symbol and adds it to the obarray. On the other hand, it is possible, but unusual, for a symbol to be unnamed, aka "uninterned". But you need not worry about this unusual situation when starting to learn about Lisp. You should instead think of a symbol as a Lisp object that _has a name_ (and possibly other properties). (Node Creating and Interning Symbols also tells you about uninterned symbols.) ___ Yes, _read the manual_. You read a bit about symbols -- good. Read that bit again. And again. It isn't rocket science, and lots of effort has gone into trying to explain things. Read an introduction to any Lisp - all Lisps have symbols. And try the functions involving symbols. Read the Intro to Elisp manual that comes with Emacs. ___ [*] More precisely, there cannot be two symbols with the same name _in the same obarray_. An obarray is essentially a symbol namespace. Each obarray can have a symbol with any name (that's unique in that obarray). Multiple obarrays can each have a symbol `foo', that is, a symbol named "foo". But those are separate, independent symbols, not the same Lisp object. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [External] : Re: Calling a function with undefined symbol 2022-10-31 17:00 ` [External] : " Drew Adams @ 2022-10-31 17:10 ` Emanuel Berg 2022-11-01 4:11 ` Drew Adams 2022-11-01 5:24 ` tomas 0 siblings, 2 replies; 46+ messages in thread From: Emanuel Berg @ 2022-10-31 17:10 UTC (permalink / raw) To: help-gnu-emacs Drew Adams wrote: > A symbol is indeed a Lisp object - an atom that has a name > and possibly other properties (value as a variable, function > definition,...). Lisp object, atom, property, value, variable, function ... it never ends ... Glossary pretty please ... -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 46+ messages in thread
* RE: [External] : Re: Calling a function with undefined symbol 2022-10-31 17:10 ` Emanuel Berg @ 2022-11-01 4:11 ` Drew Adams 2022-11-01 5:24 ` tomas 1 sibling, 0 replies; 46+ messages in thread From: Drew Adams @ 2022-11-01 4:11 UTC (permalink / raw) To: Emanuel Berg, help-gnu-emacs@gnu.org > > A symbol is indeed a Lisp object - an atom that has a name > > and possibly other properties (value as a variable, function > > definition,...). > > Lisp object, atom, property, value, variable, > function ... it never ends ... It typically ends with nil. > Glossary pretty please ... +1. 1. Yes, the Elisp manual could use a glossary. (The Emacs manual has one.) 2. Perhaps your best bet is to use `i' in the Elisp manual. E.g., `i symbol' takes you directly to node `Symbols', which tells you about symbols. 3. It can also help, IMO, to consult CLTL2. The things we've been discussing here are mostly common to other Lisps. (Obviously things such as buffers and windows are not. Not so obviously, obarrays are not - CL uses CL packages instead.) https://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html E.g., Symbols: https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node27.html 4. As far as glossaries in Info manuals go, library Info+ can help a bit by fontifying and linking glossary words from the text: options `Info-fontify-glossary-words' and `Info-link-glossary-words'. (This includes links among words within the glossary.) https://www.emacswiki.org/emacs/InfoPlus#GlossaryEnhancements But again, the Elisp manual has no glossary. Nevertheless, Emacs manual glossary entries (e.g. `list', `variable', `expression') are linked from the Elisp manual. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [External] : Re: Calling a function with undefined symbol 2022-10-31 17:10 ` Emanuel Berg 2022-11-01 4:11 ` Drew Adams @ 2022-11-01 5:24 ` tomas 2022-11-01 15:58 ` Drew Adams 1 sibling, 1 reply; 46+ messages in thread From: tomas @ 2022-11-01 5:24 UTC (permalink / raw) To: help-gnu-emacs [-- Attachment #1: Type: text/plain, Size: 663 bytes --] On Mon, Oct 31, 2022 at 06:10:40PM +0100, Emanuel Berg wrote: > Drew Adams wrote: > > > A symbol is indeed a Lisp object - an atom that has a name > > and possibly other properties (value as a variable, function > > definition,...). > > Lisp object, atom, property, value, variable, function ... it > never ends ... > > Glossary pretty please ... See the "Glossary" section in your old and trusty Emacs manual. See also the "Glossary" entry in the Emacs Wiki [1] which can be found by feeding your favourite search engine (which hopefully ain't Google: don't feed that one). Cheers [1] https://www.emacswiki.org/emacs/Glossary -- t [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] ^ permalink raw reply [flat|nested] 46+ messages in thread
* RE: [External] : Re: Calling a function with undefined symbol 2022-11-01 5:24 ` tomas @ 2022-11-01 15:58 ` Drew Adams 2022-11-01 16:13 ` tomas 0 siblings, 1 reply; 46+ messages in thread From: Drew Adams @ 2022-11-01 15:58 UTC (permalink / raw) To: tomas@tuxteam.de, help-gnu-emacs@gnu.org > See also the "Glossary" entry in the Emacs Wiki [1] > [1] https://www.emacswiki.org/emacs/Glossary Yes, I meant to also mention the glossary on the wiki. Thx. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [External] : Re: Calling a function with undefined symbol 2022-11-01 15:58 ` Drew Adams @ 2022-11-01 16:13 ` tomas 2022-11-01 19:22 ` Drew Adams 0 siblings, 1 reply; 46+ messages in thread From: tomas @ 2022-11-01 16:13 UTC (permalink / raw) To: Drew Adams; +Cc: help-gnu-emacs@gnu.org [-- Attachment #1: Type: text/plain, Size: 403 bytes --] On Tue, Nov 01, 2022 at 03:58:57PM +0000, Drew Adams wrote: > > See also the "Glossary" entry in the Emacs Wiki [1] > > [1] https://www.emacswiki.org/emacs/Glossary > > Yes, I meant to also mention the glossary on the wiki. Thx. But you are right: a reference in the Elisp manual pointing to the Glossary in the Emacs manual seems like a good idea. What do people think? Cheers -- t [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] ^ permalink raw reply [flat|nested] 46+ messages in thread
* RE: [External] : Re: Calling a function with undefined symbol 2022-11-01 16:13 ` tomas @ 2022-11-01 19:22 ` Drew Adams 0 siblings, 0 replies; 46+ messages in thread From: Drew Adams @ 2022-11-01 19:22 UTC (permalink / raw) To: tomas@tuxteam.de; +Cc: help-gnu-emacs@gnu.org > But you are right: a reference in the Elisp > manual pointing to the Glossary in the Emacs > manual seems like a good idea. I didn't add a reference in the Elisp manual point to the glossary in the Emacs manual. (I didn't modify any manuals. My code just works with the existing Emacs info files.) I added the possibility (via user option) of having occurrences of terms in the Elisp manual (first occurrence in a topic, for each) be linked to their entries in the Emacs manual. ___ Actually, there's a user option that lists the manuals with glossaries to use, in order, to link to. By default, only the Emacs and the Semantics manuals are in that list, since in the Emacs releases I have those are the only manuals that have glossaries. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-10-31 8:42 ` tomas 2022-10-31 8:57 ` Heime @ 2022-10-31 12:29 ` Stefan Monnier via Users list for the GNU Emacs text editor 2022-10-31 15:37 ` Emanuel Berg 2022-11-02 12:14 ` Michael Heerdegen 1 sibling, 2 replies; 46+ messages in thread From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-10-31 12:29 UTC (permalink / raw) To: help-gnu-emacs >> This even though the symbol "'go" does not exist. What is happening here? Nitpick: 'go is an *expression*, not a symbol. That expression returns a symbol, the symbol: go > The symbol 'seqr is just taking the job of variable name here. "The symbol 'foo" is like saying "The number '34". Better write things like: I like the symbol `seqr` and the value `34`, as well as the expression `'34`. -- Stefan ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-10-31 12:29 ` Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-10-31 15:37 ` Emanuel Berg 2022-11-02 12:14 ` Michael Heerdegen 1 sibling, 0 replies; 46+ messages in thread From: Emanuel Berg @ 2022-10-31 15:37 UTC (permalink / raw) To: help-gnu-emacs Stefan Monnier via Users list for the GNU Emacs text editor wrote: >> This even though the symbol "'go" does not exist. What is >> happening here? > > Nitpick: > > 'go > > is an *expression*, not a symbol. That expression returns > a symbol, the symbol: > > go Can't we have a list with short definitions of everything and also a diagram with arrows like: An expression -> can evaluate into -> a symbol -> which can be bound to a value -> and that binding is then known to be a variable -> ... If one is able to go thru the whole labyrinth and understand everything then at least conceptually one has understood all of Emacs and Lisp (Elisp). As for practice ... this will benefit from it (as will understanding, from practice). >> The symbol 'seqr is just taking the job of variable >> name here. > > "The symbol 'foo" is like saying "The number '34". > Better write things like: > > I like the symbol `seqr` and the value `34`, as well as > the expression `'34`. Just sayin' -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-10-31 12:29 ` Stefan Monnier via Users list for the GNU Emacs text editor 2022-10-31 15:37 ` Emanuel Berg @ 2022-11-02 12:14 ` Michael Heerdegen 2022-11-02 14:25 ` Sam Steingold 1 sibling, 1 reply; 46+ messages in thread From: Michael Heerdegen @ 2022-11-02 12:14 UTC (permalink / raw) To: Stefan Monnier via Users list for the GNU Emacs text editor Cc: Stefan Monnier Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes: > Nitpick: > > 'go > > is an *expression*, not a symbol. > That expression returns a symbol, the symbol: > > go Here is a nice exercise about that: Say the variable `x` is bound to '''''''''''''''''''''''''''''''''... i.e. a value that is a quoted thing where the thing is the same value again (such a value exists in Elisp!) - what would evaluating (eq 'x x) and (equal 'x x) yield, and why? Michael. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-02 12:14 ` Michael Heerdegen @ 2022-11-02 14:25 ` Sam Steingold 2022-11-02 16:40 ` Michael Heerdegen 0 siblings, 1 reply; 46+ messages in thread From: Sam Steingold @ 2022-11-02 14:25 UTC (permalink / raw) To: help-gnu-emacs, Michael Heerdegen > * Michael Heerdegen <zvpunry_urreqrtra@jro.qr> [2022-11-02 13:14:55 +0100]: > > Say the variable `x` is bound to > > '''''''''''''''''''''''''''''''''... i.e., (defconst x #1=(quote #1#)) right? NB: (setq print-circle t) before attempting the above! > i.e. a value that is a quoted thing where the thing is the same value > again (such a value exists in Elisp!) - what would evaluating > > (eq 'x x) > (equal 'x x) nil: you are comparing a symbol 'x' with a circular list (quote (quote ...)) what you probably meant was (eq x (eval x)) (equal x (eval x)) which both evaluate to t because eval just scrolls the circular list once - to its original starting point -- Sam Steingold (https://aphar.dreamwidth.org/) on darwin Ns 10.3.2113 https://lastingimpactpsychology.com https://steingoldpsychology.com https://www.peaceandtolerance.org/ https://www.memritv.org When C++ is your hammer, everything looks like a thumb. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-02 14:25 ` Sam Steingold @ 2022-11-02 16:40 ` Michael Heerdegen 2022-11-02 17:28 ` Emanuel Berg 2022-11-02 23:04 ` Emanuel Berg 0 siblings, 2 replies; 46+ messages in thread From: Michael Heerdegen @ 2022-11-02 16:40 UTC (permalink / raw) To: help-gnu-emacs Sam Steingold <sds@gnu.org> writes: > > '''''''''''''''''''''''''''''''''... > > i.e., > > (defconst x #1=(quote #1#)) > > right? Yep. Or #1='#1#. What strange things we can have in Elisp! > > i.e. a value that is a quoted thing where the thing is the same value > > again (such a value exists in Elisp!) - what would evaluating > > > > (eq 'x x) > > (equal 'x x) > > nil: you are comparing a symbol 'x' with a circular list > (quote (quote ...)) > > what you probably meant was [...] No, I really meant what I wrote. It was intended as that simple question. Symbols are values in Elisp, expressions can eval to symbols. That's what Stefan was talking about. The exercise's goal was to recognize that `'x` evals to a symbol, which is something entirely different than adding another quote to that strange `'''....` value (which is not a symbol in any case). If you have understood that the first value is a symbol, it's easy to give the intended answers: two times "no". Michael. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-02 16:40 ` Michael Heerdegen @ 2022-11-02 17:28 ` Emanuel Berg 2022-11-02 23:04 ` Emanuel Berg 1 sibling, 0 replies; 46+ messages in thread From: Emanuel Berg @ 2022-11-02 17:28 UTC (permalink / raw) To: help-gnu-emacs Michael Heerdegen wrote: > No, I really meant what I wrote. It was intended as that > simple question. Uhm, can we have the entire riddle in Elisp please? :) -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-02 16:40 ` Michael Heerdegen 2022-11-02 17:28 ` Emanuel Berg @ 2022-11-02 23:04 ` Emanuel Berg 2022-11-03 11:09 ` Michael Heerdegen 1 sibling, 1 reply; 46+ messages in thread From: Emanuel Berg @ 2022-11-02 23:04 UTC (permalink / raw) To: help-gnu-emacs Michael Heerdegen wrote: > The exercise's goal was to recognize that `'x` evals to > a symbol, which is something entirely different than adding > another quote to that strange `'''....` value (which is not > a symbol in any case). If you have understood that the first > value is a symbol, it's easy to give the intended answers: > two times "no". Yes, but why do you need the "strange value" for that? (setq one 1) (eq 'one one) ; nil (equal 'one one) ; nil ? -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-02 23:04 ` Emanuel Berg @ 2022-11-03 11:09 ` Michael Heerdegen 2022-11-03 12:15 ` Emanuel Berg 0 siblings, 1 reply; 46+ messages in thread From: Michael Heerdegen @ 2022-11-03 11:09 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <incal@dataswamp.org> writes: > Yes, but why do you need the "strange value" for that? I chose it because you get an `equal' value when you quote the value (to suggest a wrong track to an answer), and > (setq one 1) > > (eq 'one one) ; nil > (equal 'one one) ; nil `1` doesn't have this characteristic: `1` and `'1` are not `equal' values. Ok - so here is part two of the exercise to check whether you have understood quoting. Is the `length' of this strange value `''''''...` (a) 0 or (b) 1 or (c) 2 or (d) infinite/undefined ? Michael. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-03 11:09 ` Michael Heerdegen @ 2022-11-03 12:15 ` Emanuel Berg 2022-11-04 12:16 ` Michael Heerdegen 2022-11-04 14:33 ` Michael Heerdegen 0 siblings, 2 replies; 46+ messages in thread From: Emanuel Berg @ 2022-11-03 12:15 UTC (permalink / raw) To: help-gnu-emacs Michael Heerdegen wrote: >> Yes, but why do you need the "strange value" for that? > > I chose it because you get an `equal' value when you quote > the value (to suggest a wrong track to an answer), and You do? (setq print-circle t) (setq x #1=(quote #1#)) (eq 'x x) ; nil (equal 'x x) ; nil ? > Ok - so here is part two of the exercise to check whether > you have understood quoting. Is the `length' of this strange > value `''''''...` > > (a) 0 or > (b) 1 or > (c) 2 or > (d) infinite/undefined ? The length is 2 (it's a list) because `quote' does not evaluate anything, not even itself, however this pattern is repeated at the second element so there it is either cyclic or indefinite, (quote (quote (quote ... ))) So the length is 2, but the depth is infinite. IOW: It's a trap! -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-03 12:15 ` Emanuel Berg @ 2022-11-04 12:16 ` Michael Heerdegen 2022-11-05 14:32 ` Emanuel Berg 2022-11-04 14:33 ` Michael Heerdegen 1 sibling, 1 reply; 46+ messages in thread From: Michael Heerdegen @ 2022-11-04 12:16 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <incal@dataswamp.org> writes: > >> Yes, but why do you need the "strange value" for that? Let's call the strange `'''''''''...` values "quote-quine" for now so that it's easier to talk about them (better than saying "the strange value" all the time). I said value_s_ here because there is no unique quote-quine in the `eq' sense. > > I chose it because you get an `equal' value when you quote > > the value (to suggest a wrong track to an answer), and > > You do? > > (setq print-circle t) > > (setq x #1=(quote #1#)) > > (eq 'x x) ; nil > (equal 'x x) ; nil > > ? I don't see any place in your code where a quote-quine is quoted. You correctly assign a quote-quine to a variable. But then you only quote the symbol, not the value, and compare the quote-quine with the symbol you had bound it to. IOW: It's a trap! So how could a correct `equal'ity test of a quote-quine and that quote-quine quoted be achieved? This is exercise number 3. > So the length is 2, but the depth is infinite. IOW: It's a trap! Yes, this is the correct solution. Congratulations! Michael. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-04 12:16 ` Michael Heerdegen @ 2022-11-05 14:32 ` Emanuel Berg 2022-11-05 23:22 ` Michael Heerdegen 0 siblings, 1 reply; 46+ messages in thread From: Emanuel Berg @ 2022-11-05 14:32 UTC (permalink / raw) To: help-gnu-emacs Michael Heerdegen wrote: >> (setq print-circle t) >> >> (setq x #1=(quote #1#)) >> >> (eq 'x x) ; nil >> (equal 'x x) ; nil >> >> ? > > I don't see any place in your code where a quote-quine is > quoted. You correctly assign a quote-quine to a variable. > But then you only quote the symbol, not the value, and > compare the quote-quine with the symbol you had bound it to. > > IOW: It's a trap! > > So how could a correct `equal'ity test of a quote-quine and > that quote-quine quoted be achieved? Beats me! Because quoting it will just add another level/layer of the same, and in the same way, to something that is already infinite. (setq print-circle t) (setq x #1=(quote #1#)) (equal x #1=(quote #1#)) ; t (equal x (quote #1=(quote #1#))) ; t (equal x (quote (quote #1=(quote #1#)))) ; and so on So I give my tongue to the cat then? -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-05 14:32 ` Emanuel Berg @ 2022-11-05 23:22 ` Michael Heerdegen 2022-11-06 20:17 ` Emanuel Berg 0 siblings, 1 reply; 46+ messages in thread From: Michael Heerdegen @ 2022-11-05 23:22 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <incal@dataswamp.org> writes: > (setq print-circle t) > > (setq x #1=(quote #1#)) > > (equal x #1=(quote #1#)) ; t > > (equal x (quote #1=(quote #1#))) ; t > > (equal x (quote (quote #1=(quote #1#)))) ; and so on You do it... but indirectly. I wanted to add a quote to the value already generated. Like this: (equal #1='#1# ''#1#) ==> t or (let ((x #1='#1#)) (equal x `',x)) ==> t The backquote-quote-unquote combination is a nicely short way of quoting an existing value (instead of an expression like a symbol). But the conclusion is the same as you described. Michael. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-05 23:22 ` Michael Heerdegen @ 2022-11-06 20:17 ` Emanuel Berg 2022-11-07 16:03 ` Michael Heerdegen 0 siblings, 1 reply; 46+ messages in thread From: Emanuel Berg @ 2022-11-06 20:17 UTC (permalink / raw) To: help-gnu-emacs Michael Heerdegen wrote: > You do it... but indirectly. I wanted to add a quote to the > value already generated. Like this: > > (equal #1='#1# ''#1#) ==> t > > or > > (let ((x #1='#1#)) > (equal x `',x)) ==> t > > The backquote-quote-unquote combination is a nicely short > way of quoting an existing value (instead of an expression > like a symbol). > > But the conclusion is the same as you described. Can't you put these and other such questions you may know of into a document and others can add theirs ... don't know if I know any? -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-06 20:17 ` Emanuel Berg @ 2022-11-07 16:03 ` Michael Heerdegen 2022-11-07 16:50 ` [External] : " Drew Adams 2022-11-07 16:52 ` Emanuel Berg 0 siblings, 2 replies; 46+ messages in thread From: Michael Heerdegen @ 2022-11-07 16:03 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <incal@dataswamp.org> writes: > Can't you put these and other such questions you may know of These were just improvised for fun... > into a document and others can add theirs ... don't know if I know > any? In my objective point of view the canonical person for the task is...Emanuel Berg! (not kidding) Michael. ^ permalink raw reply [flat|nested] 46+ messages in thread
* RE: [External] : Re: Calling a function with undefined symbol 2022-11-07 16:03 ` Michael Heerdegen @ 2022-11-07 16:50 ` Drew Adams 2022-11-07 16:52 ` Emanuel Berg 1 sibling, 0 replies; 46+ messages in thread From: Drew Adams @ 2022-11-07 16:50 UTC (permalink / raw) To: Michael Heerdegen, help-gnu-emacs@gnu.org > Emanuel Berg <incal@dataswamp.org> writes: > > > Can't you put these and other such questions you may know of > > These were just improvised for fun... > > > into a document and others can add theirs ... don't know if I know > > any? > > In my objective point of view the canonical person for the task > is...Emanuel Berg! (not kidding) Open encouragement/invitation for The Canonical Berg to do it! (Anyone can create pages on Emacs Wiki, for instance.) ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-07 16:03 ` Michael Heerdegen 2022-11-07 16:50 ` [External] : " Drew Adams @ 2022-11-07 16:52 ` Emanuel Berg 2022-11-08 15:52 ` Michael Heerdegen 1 sibling, 1 reply; 46+ messages in thread From: Emanuel Berg @ 2022-11-07 16:52 UTC (permalink / raw) To: help-gnu-emacs Michael Heerdegen wrote: >> into a document and others can add theirs ... don't know if >> I know any? > > In my objective point of view the canonical person for the > task is...Emanuel Berg! (not kidding) Okay, I'll get right to it! Hey, wait ... nice try :) -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-07 16:52 ` Emanuel Berg @ 2022-11-08 15:52 ` Michael Heerdegen 2022-11-08 19:15 ` tomas ` (2 more replies) 0 siblings, 3 replies; 46+ messages in thread From: Michael Heerdegen @ 2022-11-08 15:52 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <incal@dataswamp.org> writes: > > In my objective point of view the canonical person for the > > task is...Emanuel Berg! (not kidding) > > Okay, I'll get right to it! Good. You may add (d) What's the return value of evaluating the expression (funcall (lambda (x) (funcall x x)) (lambda (x) (funcall x x))) > Hey, wait ... nice try :) Eh - dito. Michael. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-08 15:52 ` Michael Heerdegen @ 2022-11-08 19:15 ` tomas 2022-11-08 19:57 ` Michael Heerdegen 2022-11-08 21:35 ` Sam Steingold 2022-11-16 19:07 ` Emanuel Berg 2 siblings, 1 reply; 46+ messages in thread From: tomas @ 2022-11-08 19:15 UTC (permalink / raw) To: help-gnu-emacs [-- Attachment #1: Type: text/plain, Size: 634 bytes --] On Tue, Nov 08, 2022 at 04:52:38PM +0100, Michael Heerdegen wrote: > Emanuel Berg <incal@dataswamp.org> writes: > > > > In my objective point of view the canonical person for the > > > task is...Emanuel Berg! (not kidding) > > > > Okay, I'll get right to it! > > Good. You may add > > (d) What's the return value of evaluating the expression > > (funcall > (lambda (x) (funcall x x)) > (lambda (x) (funcall x x))) Now would that be more fun if Elisp did tail call optimization? Let me try in Guile: scheme@(guile-user)> ((lambda (x) (x x)) (lambda (x) (x x))) Yes, it is :) Cheers -- t [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-08 19:15 ` tomas @ 2022-11-08 19:57 ` Michael Heerdegen 2022-11-08 20:47 ` tomas 0 siblings, 1 reply; 46+ messages in thread From: Michael Heerdegen @ 2022-11-08 19:57 UTC (permalink / raw) To: help-gnu-emacs <tomas@tuxteam.de> writes: > Now would that be more fun if Elisp did tail call optimization? > > Let me try in Guile: > > scheme@(guile-user)> ((lambda (x) (x x)) (lambda (x) (x x))) > > Yes, it is :) Impressive - it just produces a bit of heat over time, but it doesn't consume memory. Michael. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-08 19:57 ` Michael Heerdegen @ 2022-11-08 20:47 ` tomas 0 siblings, 0 replies; 46+ messages in thread From: tomas @ 2022-11-08 20:47 UTC (permalink / raw) To: help-gnu-emacs [-- Attachment #1: Type: text/plain, Size: 533 bytes --] On Tue, Nov 08, 2022 at 08:57:59PM +0100, Michael Heerdegen wrote: > <tomas@tuxteam.de> writes: > > > Now would that be more fun if Elisp did tail call optimization? > > > > Let me try in Guile: > > > > scheme@(guile-user)> ((lambda (x) (x x)) (lambda (x) (x x))) > > > > Yes, it is :) > > Impressive - it just produces a bit of heat over time, but it doesn't > consume memory. To be more precise, it always consumes the same memory. Perhaps the bits become somewhat worn out in that place ;-P Cheers -- t [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 195 bytes --] ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-08 15:52 ` Michael Heerdegen 2022-11-08 19:15 ` tomas @ 2022-11-08 21:35 ` Sam Steingold 2022-11-08 23:53 ` Michael Heerdegen 2022-11-16 19:07 ` Emanuel Berg 2 siblings, 1 reply; 46+ messages in thread From: Sam Steingold @ 2022-11-08 21:35 UTC (permalink / raw) To: help-gnu-emacs, Michael Heerdegen > * Michael Heerdegen <zvpunry_urreqrtra@jro.qr> [2022-11-08 16:52:38 +0100]: > > (d) What's the return value of evaluating the expression > > (funcall > (lambda (x) (funcall x x)) > (lambda (x) (funcall x x))) or this: ((lambda (x) `(,x ',x)) '(lambda (x) `(,x ',x))) -- Sam Steingold (https://aphar.dreamwidth.org/) on darwin Ns 10.3.2113 https://lastingimpactpsychology.com https://steingoldpsychology.com http://think-israel.org https://honestreporting.com https://www.memritv.org Telling a programmer there's already a library to do X is like telling a songwriter there's already a song about love. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-08 21:35 ` Sam Steingold @ 2022-11-08 23:53 ` Michael Heerdegen 2022-11-09 15:32 ` Sam Steingold 0 siblings, 1 reply; 46+ messages in thread From: Michael Heerdegen @ 2022-11-08 23:53 UTC (permalink / raw) To: help-gnu-emacs Sam Steingold <sds@gnu.org> writes: > or this: > > ((lambda (x) `(,x ',x)) '(lambda (x) `(,x ',x))) Then I would say (#1=(lambda (x) '(#1# '#1#)) #1#) to get rid of duplicated lambdas and backquotes in the code (isn't it much better readable now?). Michael. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-08 23:53 ` Michael Heerdegen @ 2022-11-09 15:32 ` Sam Steingold 2022-11-09 15:59 ` Michael Heerdegen 0 siblings, 1 reply; 46+ messages in thread From: Sam Steingold @ 2022-11-09 15:32 UTC (permalink / raw) To: help-gnu-emacs, Michael Heerdegen > * 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#) > (isn't it much better readable now?). I would rather avoid circular lists _in code_. (and your version is _not_ the same as mine) -- Sam Steingold (https://aphar.dreamwidth.org/) on darwin Ns 10.3.2113 https://lastingimpactpsychology.com https://steingoldpsychology.com https://www.dhimmitude.org https://memri.org https://iris.org.il Lottery is a tax on statistics ignorants. MS is a tax on computer-idiots. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-09 15:32 ` Sam Steingold @ 2022-11-09 15:59 ` Michael Heerdegen 0 siblings, 0 replies; 46+ messages in thread From: Michael Heerdegen @ 2022-11-09 15:59 UTC (permalink / raw) To: help-gnu-emacs 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. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-08 15:52 ` Michael Heerdegen 2022-11-08 19:15 ` tomas 2022-11-08 21:35 ` Sam Steingold @ 2022-11-16 19:07 ` Emanuel Berg 2022-11-16 21:40 ` [External] : " Drew Adams 2 siblings, 1 reply; 46+ messages in thread From: Emanuel Berg @ 2022-11-16 19:07 UTC (permalink / raw) To: help-gnu-emacs Michael Heerdegen wrote: >>> In my objective point of view the canonical person for the >>> task is...Emanuel Berg! (not kidding) >> >> Okay, I'll get right to it! > > Good. You may add (d) OK, I'll do it! But what were (a) to (c) exactly since there were so much discussion ... I'll add my own egg boiler question! When we have say - I don't know how many - we will have Drew mail the Emacs Wiki maintainer and ask if he can add it there ... > What's the return value of evaluating the expression > > (funcall > (lambda (x) (funcall x x)) > (lambda (x) (funcall x x))) I don't know! :O What is it? -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 46+ messages in thread
* RE: [External] : Re: Calling a function with undefined symbol 2022-11-16 19:07 ` Emanuel Berg @ 2022-11-16 21:40 ` Drew Adams 2022-11-16 21:55 ` Emanuel Berg 0 siblings, 1 reply; 46+ messages in thread From: Drew Adams @ 2022-11-16 21:40 UTC (permalink / raw) To: Emanuel Berg, help-gnu-emacs@gnu.org > When we have say - I don't know how many - we will have Drew > mail the Emacs Wiki maintainer and ask if he can add it > there ... Hm. I've said this several times before, but once more... _Anyone_ can create and edit pages on Emacs Wiki. And the home page tells you this and how to do it. https://www.emacswiki.org/emacs/SiteMap See the "How to use this site" links on that page. In particular, "How To Edit": https://www.emacswiki.org/emacs/HowToEdit, which has a link to page "Create New Pages": https://www.emacswiki.org/emacs/CreateNewPages Try it! Create a page. If you don't want it to stay up, then delete it: https://www.emacswiki.org/emacs/DeletedPage And there's a "Sand Box" page, where you can try out how to write/edit different things, to get the appearance you want. https://www.emacswiki.org/emacs/SandBox ___ No need for anyone to email the wiki maintainer and ask him for anything. About the only thing I email him for is if I think there's some kind of problem with the site, e.g., the server needs to be rebooted. > > What's the return value of evaluating the expression > > (funcall > > (lambda (x) (funcall x x)) > > (lambda (x) (funcall x x))) > > I don't know! :O > What is it? Enter (λ x.xx)(λ x.xx) here: https://lambdacalc.io/ ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: [External] : Re: Calling a function with undefined symbol 2022-11-16 21:40 ` [External] : " Drew Adams @ 2022-11-16 21:55 ` Emanuel Berg 0 siblings, 0 replies; 46+ messages in thread From: Emanuel Berg @ 2022-11-16 21:55 UTC (permalink / raw) To: help-gnu-emacs Drew Adams wrote: >>> What's the return value of evaluating the expression >>> >>> (funcall >>> (lambda (x) (funcall x x)) >>> (lambda (x) (funcall x x))) >> >> I don't know! :O >> What is it? > > Enter (λ x.xx)(λ x.xx) here: > > https://lambdacalc.io/ ? Why do you say that? Everyone can use that site. -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-03 12:15 ` Emanuel Berg 2022-11-04 12:16 ` Michael Heerdegen @ 2022-11-04 14:33 ` Michael Heerdegen 2022-11-05 12:57 ` Emanuel Berg 1 sibling, 1 reply; 46+ messages in thread From: Michael Heerdegen @ 2022-11-04 14:33 UTC (permalink / raw) To: help-gnu-emacs Emanuel Berg <incal@dataswamp.org> writes: > [...] because `quote' does not evaluate anything, not even > itself [...] I'm not so happy with this sentence, however. Not sure what you intended to say. Because, note that quotes (or quoted values, to be more precise) are _not_ self-quoting: evaluating a quoted value normally yields something different (i.e., the value, but not the quoted value). In that point `quote' is different from how `lambda' forms behave in dynamically binding Elisp ("self quoting"): (setq x '(lambda () 1)) ;; x -> (lambda nil 1) (eval x nil) ==> (lambda nil 1) (equal x (eval x nil)) ==> t but OTOH (setq x ''nil) ;; x -> 'nil (eval x nil) ==> nil, not 'nil (equal x (eval x nil)) ==> nil It is important to differentiate between forms and the results of evaluation of forms the make clear what one is meaning. Michael. ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-11-04 14:33 ` Michael Heerdegen @ 2022-11-05 12:57 ` Emanuel Berg 0 siblings, 0 replies; 46+ messages in thread From: Emanuel Berg @ 2022-11-05 12:57 UTC (permalink / raw) To: help-gnu-emacs Michael Heerdegen wrote: >> because `quote' does not evaluate anything, not even >> itself > > I'm not so happy with this sentence, however. Not sure what > you intended to say. If you evaluate `quote' you get the argument but it isn't evaluated, and this doesn't change if the argument is another quote. (+ 1 2 3) ; 6 (quote (+ 1 2 3)) ; not evaluated into 6, instead it's a list (quote (quote (+ 1 2 3))) ; now it's a list with quote as the first element And so on. -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 46+ messages in thread
* Re: Calling a function with undefined symbol 2022-10-31 8:15 Calling a function with undefined symbol Heime 2022-10-31 8:32 ` Jean Abou Samra 2022-10-31 8:42 ` tomas @ 2022-10-31 11:34 ` Emanuel Berg 2 siblings, 0 replies; 46+ messages in thread From: Emanuel Berg @ 2022-10-31 11:34 UTC (permalink / raw) To: help-gnu-emacs Heime wrote: > I can call this function with > > (mbcomplt 'go) > > This even though the symbol "'go" does not exist. C'mon now, it's such a common and short name, no doubt someone in the Lisp world has defined it already! Actually there are a lot more exotic ones that are also symbols, e.g. (symbolp 'symbols-are-us) ; t Go on, try a bunch with `symbolp' yourself, you'll be surprised how many symbols there are out there ... -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 46+ messages in thread
end of thread, other threads:[~2022-11-16 21:55 UTC | newest] Thread overview: 46+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-10-31 8:15 Calling a function with undefined symbol Heime 2022-10-31 8:32 ` Jean Abou Samra 2022-10-31 8:42 ` tomas 2022-10-31 8:57 ` Heime 2022-10-31 9:07 ` tomas 2022-10-31 9:24 ` Jean Abou Samra 2022-10-31 9:43 ` Heime 2022-10-31 9:58 ` Jean Abou Samra 2022-10-31 10:57 ` Heime 2022-10-31 17:00 ` [External] : " Drew Adams 2022-10-31 17:10 ` Emanuel Berg 2022-11-01 4:11 ` Drew Adams 2022-11-01 5:24 ` tomas 2022-11-01 15:58 ` Drew Adams 2022-11-01 16:13 ` tomas 2022-11-01 19:22 ` Drew Adams 2022-10-31 12:29 ` Stefan Monnier via Users list for the GNU Emacs text editor 2022-10-31 15:37 ` Emanuel Berg 2022-11-02 12:14 ` Michael Heerdegen 2022-11-02 14:25 ` Sam Steingold 2022-11-02 16:40 ` Michael Heerdegen 2022-11-02 17:28 ` Emanuel Berg 2022-11-02 23:04 ` Emanuel Berg 2022-11-03 11:09 ` Michael Heerdegen 2022-11-03 12:15 ` Emanuel Berg 2022-11-04 12:16 ` Michael Heerdegen 2022-11-05 14:32 ` Emanuel Berg 2022-11-05 23:22 ` Michael Heerdegen 2022-11-06 20:17 ` Emanuel Berg 2022-11-07 16:03 ` Michael Heerdegen 2022-11-07 16:50 ` [External] : " Drew Adams 2022-11-07 16:52 ` Emanuel Berg 2022-11-08 15:52 ` Michael Heerdegen 2022-11-08 19:15 ` tomas 2022-11-08 19:57 ` Michael Heerdegen 2022-11-08 20:47 ` tomas 2022-11-08 21:35 ` Sam Steingold 2022-11-08 23:53 ` Michael Heerdegen 2022-11-09 15:32 ` Sam Steingold 2022-11-09 15:59 ` Michael Heerdegen 2022-11-16 19:07 ` Emanuel Berg 2022-11-16 21:40 ` [External] : " Drew Adams 2022-11-16 21:55 ` Emanuel Berg 2022-11-04 14:33 ` Michael Heerdegen 2022-11-05 12:57 ` Emanuel Berg 2022-10-31 11:34 ` Emanuel Berg
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).