[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Calling a function with undefined symbol
From: |
Jean Abou Samra |
Subject: |
Re: Calling a function with undefined symbol |
Date: |
Mon, 31 Oct 2022 10:58:50 +0100 |
> 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.
- Calling a function with undefined symbol, Heime, 2022/10/31
- Re: Calling a function with undefined symbol, Jean Abou Samra, 2022/10/31
- Re: Calling a function with undefined symbol, tomas, 2022/10/31
- Re: Calling a function with undefined symbol, Heime, 2022/10/31
- Re: Calling a function with undefined symbol, tomas, 2022/10/31
- Re: Calling a function with undefined symbol, Jean Abou Samra, 2022/10/31
- Re: Calling a function with undefined symbol, Heime, 2022/10/31
- Re: Calling a function with undefined symbol,
Jean Abou Samra <=
- Re: Calling a function with undefined symbol, Heime, 2022/10/31
- RE: [External] : Re: Calling a function with undefined symbol, Drew Adams, 2022/10/31
- Re: [External] : Re: Calling a function with undefined symbol, Emanuel Berg, 2022/10/31
Re: Calling a function with undefined symbol, Stefan Monnier, 2022/10/31
Re: Calling a function with undefined symbol, Emanuel Berg, 2022/10/31