axiom-developer
[Top][All Lists]

## [Axiom-developer] [SExpression] (new)

 From: billpage Subject: [Axiom-developer] [SExpression] (new) Date: Wed, 07 Dec 2005 01:10:40 -0600

Changes http://wiki.axiom-developer.org/SExpression/diff
--
This Axiom domain allows the manipulation of the usual Lisp values.

\begin{axiom}
)show SExpression
\end{axiom}

Reference:

http://en.wikipedia.org/wiki/S-expression --
An S-expression (S stands for symbolic) is a convention for
representing data structures in a text form. S-expressions are
most commonly used in the Lisp.

S-expressions are used for both code and data in Lisp.
(see McCarthy Recursive Functions of Symbolic Expressions at
http://www-formal.stanford.edu/jmc/recursive/recursive.html).

S-expressions can either be single objects such as numbers,
LISP atoms including the special atoms nil and t, or cons pairs,
written as (x . y). Longer lists are made up of nested cons pairs,
for example (1 . (2 . (3 . nil))) which can also be written more
intelligibly as (1 2 3).

Program code can be written in S-expressions, using prefix notation.
The common expression (quote x) can be written with the abbreviation
'x.

Example in Common Lisp:
\begin{lisp}
(defun factorial (x)
(if (zerop x) 1
(* x (factorial (- x 1)))))
\end{lisp}

\begin{axiom}
integer(FACTORIAL(10)\$Lisp)
\end{axiom}

--