wolf:~> clisp
i i i i i i i ooooo o ooooooo ooooo ooooo
I I I I I I I 8 8 8 8 8 o 8 8
I \ `+' / I 8 8 8 8 8 8
\ `-+-' / 8 8 8 ooooo 8oooo
`-__|__-' 8 8 8 8 8
| 8 o 8 8 o 8 8
------+------ ooooo 8oooooo ooo8ooo ooooo 8
Welcome to GNU CLISP 2.49 (2010-07-07)
Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2010
Type :h and hit Enter for context help.
[1]> (setf x1 1)
1
[2]> (setf y1 2)
2
[3]> (setf x2 3)
3
[4]> (setf y2 4)
4
[5]> (cons x1 y1)
(1 . 2)
[6]> (cons x2 y2)
(3 . 4)
[7]> ;binding the list of the elements x1 y1 to a variable to correspond to a conceptual point in 2d space
(setf p1 (cons x1 y1))
(1 . 2)
[8]> ;binding the list of the elements x2 y2 to a variable to correspond to a conceptual point in 2d space
(setf p2 (cons x2 y2))
(3 . 4)
[9]> ;computing the distance between the 2 points in 2d space
(setf distance (sqrt (+ (expt (- (car p2) (car p1)) 2) (expt (- (cdr p2) (cdr p1)) 2))))
2.828427
[10]> (car (cddr '(A B X C D)))
X
[11]> (caar (cddr '(A B (X) C D)))
X
[12]> (car (cdar (cdar '((A (B X C D))))))
X
[13]> (setf colors '(RED BLUE GREEN YELLOW ORANGE PURPLE WHITE))
(RED BLUE GREEN YELLOW ORANGE PURPLE WHITE)
[14]> (quote colors)
COLORS
[15]> 'colors
COLORS
[16]> colors
(RED BLUE GREEN YELLOW ORANGE PURPLE WHITE)
[17]> (describe 'colors)
COLORS is the symbol COLORS, lies in #, is accessible in 1
package COMMON-LISP-USER, a variable, value: (RED BLUE GREEN YELLOW ORANGE PURPLE WHITE).
# is the package named COMMON-LISP-USER. It has 2 nicknames
CL-USER, USER.
It imports the external symbols of 2 packages COMMON-LISP, EXT and exports no symbols,
but no package uses these exports.
(RED BLUE GREEN YELLOW ORANGE PURPLE WHITE) is a list of length 7.
[18]> (describe colors)
(RED BLUE GREEN YELLOW ORANGE PURPLE WHITE) is a list of length 7.
[19]> (type-of 'colors)
SYMBOL
[20]> (type-of colors)
CONS
[21]> (typep colors 'cons)
T
[22]> (typep colors 'list)
T
[23]> (typep colors 'symbol)
NIL
[24]> (typep 'colors 'cons)
NIL
[25]> (bye)
Bye.