[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] lispdoc

From: daly
Subject: [Axiom-developer] lispdoc
Date: Wed, 16 May 2007 10:09:05 -0500


The vertical bars are escape characters and are not part of the identifier,
thus |foo| is the identifier foo. The lisp reader capitalizes all input
by default so there is no difference between foo, Foo, or FOO.
This is rarely used (except that boot wants to be dual-cased).

The * around identifiers is purely a convention. They indicate (but
do not require) that the symbol is globally visible rather than 
something locally defined. That way you can tell if you're 
manipulating something globally without checking the locally
defined variables. Thus *asdf* is "global" by convention, not by
definition. Axiom used a "$asdf" convention.

The : in front of the identifier means that this symbol is in 
a special "package". Packages are collections of names and every
name in lisp is in a package. Thus most names in Axiom are in the
boot package and the full name of an identifier foo is boot::foo.
There is a special package called the "keyword" package which
can be seen everywhere. The notation for a symbol in the keyword
package is :foo

Think of a symbol in common lisp as a C struct. It has 5 parts:
  { package   ; the package containing this symbol
    name      ; a string that is the print name
    value     ; the meaning of foo in a value position (myfunc foo)
    function  ; the meaning of foo in the function position (foo....)
    plist     ; a list of (key value key value .....)

You can see this by:
(setq foo 5)                 <== set the symbol-value, name, and package
(defun foo () "hello world") <== set the symbol-function
(setf (get 'foo 'barry) 7)   <== add (barry 7) to the property list

(symbol-package 'foo)  ==> #<PACKAGE COMMON-LISP-USER>
(symbol-value 'foo)    ==> 5
(symbol-function 'foo) ==> #<FUNCTION FOO NIL (defun foo () "hello world")>
(symbol-name 'foo)     ==> "FOO"
(symbol-plist 'foo)    ==> (barry 7 ..... )

Every symbol has these 5 parts. If the current package is the same
as the package field of the symbol then you just use the symbol name.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]