On Mon, Mar 30, 2026 at 05:04:30AM +0200, [email protected] wrote:
> David Zelinsky:
> ...
> > In Lisp (of which Scheme is a dialect) a "symbol" is an identifier,
> > which can have simultaenous associated values of one or more of various
> > types, including variable or function.  Which value type is used depends
> > on context.  A slightlhy more detailed explanation is here:
> > 
> >    https://en.wikipedia.org/wiki/Common_Lisp#Scalar_types
> ...
> 
>  I don't follow, well yes [1] says with some vague wordings that a symbol
>  is an identifier also somewhat implying that it isn't a variable,
>  [2] says it is type but doesn't really bother to explain it.
>  I just find a lot jumbo mumbo, perhaps someone who alreade knows
>  guile in and out would perhaps understand it perfectly well...
> 
> [1] https://people.csail.mit.edu/jaffer/r5rs_4.html#SEC15
> [2] https://people.csail.mit.edu/jaffer/r5rs_5.html#SEC20
> 
>  And regarding common lisp, Guy L. Steele Jr. writes in his book
>  "common lisp" from 1990 that (section 2.3. Symbols): 
>    Symbols are Lisp data objects that serve several purposes and have 
>    several interesting characteristics. Every object of type 
>    ??symbol?? has a name, called its "print name".
>    ...
>    Symbols have a component called the "property list", or "plist".
>    ...
>    Symbols are also used to represent certain kinds of variables in
>    Lisp programs,
> 
>  So, it seems clear to me that a symbol cannot be a simple variable
>  like the "a" one here: a = \lyricmode { hello }
> 
>  [3] shows a symbol: 'thickness
>  Does that mean that the only symbols in lilypond are thoose in
>  scm/define-music-types.scm ?
> 
> [3] https://lilypond.org/doc/v2.25/Documentation/extending/property-alists 
> 
> Regards,
> /Karl Hammar

I don't know much about LilyPond internals.  But in Scheme (or other Lisp 
variants) any syntactically allowed identifier preceded by a single quote is a 
symbol.

I think of a Lisp symbol as kind of like a C struct with fields named 
"variable" and "function" and a couple others.  Except rather than accessing 
the fields by naming them, they are accessed implicitly by the way the symbol 
is used.  So, calling "set" on a symbol sets its variable value, and using it 
(without the single quote) as the argument to a function access that value.  
And using it with "defun" sets its function value; and using it as a function 
accesses that value.

There may be a more precise computer-science description of a symbol, but in my 
experience, the description I gave seems to fit well with usage.

-David

Reply via email to