1. Symbols Definition
SymbolsAre used for theirObjectIdentity to name varous entities
InCommon LISP, Including (but not limited to) Linguistic entities such
AsVariablesAndFunctions.
2. built-in symbol
Intern symbol --Interned SymbolIs uniquely identifiable by its
NameFrom anyPackageIn which it isAccessible.
3. Convert the string to symbol
;;;
; Description: the right side of the code => "..." indicates the output of each line of code.
;;;
(SETF symbol-string "sym") => "sym"
(SETF symbol-object (intern symbol-string) => sym
(Symbolp symbol-object) => T
(SETF (get symbol-object 'symbol-name) "sym") => "sym"
(SETF (get symbol-object 'symbol-value) "sym") => "sym"
4. symbol Structure
Each symbol has the following main structure:
; Name ---> "foo"
; Package ---> in some package
; Value ---> 27
; Function --- ># <function>
; Plist ---> (color red)
From Paul Graham's ANSI Common Lisp. p135
5. fboudp checks whether a symbol is a function name.
(Fboundp 'acs-Main-loop) => T; ACs-Main-loop is a function name.
(Fboundp 'asymbol) => nil; asymbol is just a symbol
6. Determine whether a symbol is a class name
(Find-class 'patc-pattern nil) => T; patc-pattern is a class name
(Find-class 'patx-pattern nil) => nil; patx-pattern is not a class
Pay attention to the following parameters of find-class:
Syntax:
Find-class
Symbol& OptionalErrorp Environment=>
Class
(SETF(Find-class Symbol& OptionalErrorp
Environment)New-class)
When errorp is set to nil, type error is not thrown.