Search code examples
chicken-scheme

Is there a shorthand syntax for list that allows symbols in Chicken Scheme?


When I write:

'(1 2 3)

I get a list:

(1 2 3)

When I write:

'some-symbol

I get:

some-symbol

When I write:

'('some-symbol)

I get:

((quote some-symbol))

I can of course write:

(list 'some-symbol)

and I get:

(some-symbol)

which is the desired output. Is it correct that I cannot quote a symbol in a list like:

'(some-symbol)

Is there some other shorthand for the list operator that I am missing?


Solution

  • Quote will quote the entire s-expression that follows. So, in that sense,

    '(some-symbol)
    

    will actually be a quoted list containing the symbol you're looking for.

    The quote sign is a shorthand for (quote ...), so

    '(some-symbol)
    

    is equivalent to

    (quote (some-symbol))