CLISP Command Line Interface (CLI)
Arithmetic operations
kodingwindow@kw:~$ clisp ... [1]> (+ 7 19) 26 [2]> (+ 7 93 100 900) 1100 [3]> (+ 7 93) 100 [4]> (- 7 93) -86 [5]> (* 7 93) 651 [6]> (/ 1 0) *** - /: division by zero The following restarts are available: ABORT :R1 Abort main loop [7]> :q [8]> (/ 7 93) 7/93 [9]> (/ 7 93.0) 0.07526882 [10]> (= 100(+ 7 93)) T [11]
> PI 3.1415926535897932385L0 [12]> pi 3.1415926535897932385L0
String operations
[1]> "Hello World" "Hello World" [2]> (length "Hello World") 11 [3]> (char "Hello World"0) #\H [4]> (char "Hello World"10) #\d [5]> 'hello HELLO [6]> 'h\ello |HeLLO| [7]> 'h|ello| |Hello|
type-of function
[1]> (type-of 0) BIT [2]> (type-of 1) BIT [3]> (type-of 2) (INTEGER 0 281474976710655) [4]> (type-of '1e2) SINGLE-FLOAT [5]> (type-of pi) LONG-FLOAT [6]> (type-of 'pi) SYMBOL [7]> (type-of +) CONS [8]> (type-of -) CONS [9]> (type-of *) SYMBOL [10]> (type-of /) CONS [11]> (type-of "Hello World") (SIMPLE-BASE-STRING 11) [12]> (type-of *package*) PACKAGE
symbol-name function
[1]> (symbol-name 'hello) "HELLO" [2]> (symbol-name '|hello|) "hello" [3]> (string=(symbol-name'h|ello|)"Hello") T
eql function
[1]> (eql'A'a) T [2]> (eql 50 50.0) NIL [3]> (eql 50 50) T
random function
[1]> (random 500) 153 [2]> (random 500.0) 497.5427
remove function
[1]> (remove 1'(4 1 5 1 7 2 9 1 5 2 1)) (4 5 7 2 9 5 2) [2]> (remove 'r'(r a d a r)) (A D A)
What Next?
Maxima Command Line Interface (CLI)
LISP Hello World program
LISP program to perform the arithmetic operations
Advertisement