unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Heime <heimeborgia@protonmail.com>
To: tomas@tuxteam.de
Cc: help-gnu-emacs@gnu.org
Subject: Re: Calling a function with undefined symbol
Date: Mon, 31 Oct 2022 08:57:09 +0000	[thread overview]
Message-ID: <PnCdVt1Ag4FTqCRqp5zWYJ0pBsarv24b10GohZcTY0xQR3LgFk6gS2204qo4404P68dZa0G_P3LGgVIdB4jTvjpc4uBkGglHa3-3e10mObc=@protonmail.com> (raw)
In-Reply-To: <Y1+KjRmA1T0hdr68@tuxteam.de>

------- 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?



  reply	other threads:[~2022-10-31  8:57 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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='PnCdVt1Ag4FTqCRqp5zWYJ0pBsarv24b10GohZcTY0xQR3LgFk6gS2204qo4404P68dZa0G_P3LGgVIdB4jTvjpc4uBkGglHa3-3e10mObc=@protonmail.com' \
    --to=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tomas@tuxteam.de \
    /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).