sabof
sabof

Reputation: 8192

Am I missing some important fact about symbols in LISP?

What is the correct way to do this?

(defparameter form1 (list 'baz "hello"))
(setf (car form1) (intern "print"))
(eval form1)

What is the significance of || (intern) uses?
What is the significance of #:|| (make-symbol) uses?

If they are just part of the name, what is the rationale of creating a different symbol from that which I have specified?

Update: (intern "PRINT") works

Upvotes: 2

Views: 126

Answers (1)

Rörd
Rörd

Reputation: 6681

The vertical bars are the quotes for symbols. Symbols that you've entered literally in the source code don't use them because the reader turns them into all-caps, and all-caps symbols don't need to be quoted.

The #: at the front signifies uninterned symbols, i.e. symbols that don't belong to any package. intern puts symbols into the current package. Only symbols of the current package are printed without the name of their package.

Upvotes: 5

Related Questions