Symbols and Keywords

'foo                                  ; the symbol FOO (the reader upcases)
'|Mixed Case|                         ; |Mixed Case|: vertical bars preserve case and spaces
(symbol-name 'foo)                    ; "FOO"
(intern "BAR")                        ; BAR, NIL/:INTERNAL (find or create a symbol in the current package)
(find-symbol "CAR" :cl)               ; CAR, :EXTERNAL
(make-symbol "TEMP")                  ; #:TEMP: an uninterned symbol
(gensym "TMP")                        ; #:TMP123: a fresh uninterned symbol (used in macros)
(symbol-package 'car)                 ; #<PACKAGE "COMMON-LISP">
(symbolp 'a) (keywordp :a)            ; T T

;; A symbol has: a name, a package, a value cell, a function cell, and a property list
(setf (symbol-value 'my-var) 42)      ; global value (like defparameter without declaring special)
(boundp 'my-var)                      ; T
(symbol-value 'my-var)                ; 42
(fboundp 'car)                        ; T
(symbol-function 'car)                ; #<FUNCTION CAR>
(symbol-plist 'apple)                 ; the property list

;; Keywords live in the KEYWORD package and evaluate to themselves
:name                                 ; :NAME
(eq :name
…