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 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-2006 [1]> (setq x (lambda (x) (+ x 1))) # [6]> ((lambda (x) (+ x 1)) 5) 6 [6]> (mapcar (lambda (x) (+ x 1)) '(5 6 7 8)) (6 7 8 9) [9]> x # [13]> (defun silnia (x) (cond ((= x 0) 1) (t (* x(silnia (- x 1)))))) SILNIA [13]> (silnia 5) 120 [15]> (defun silnia (x) (if (= x 0) 1 (* x(silnia (- x 1))))) SILNIA [15]> (silnia 5) 120 [15]> (if 0 4 7) 4 [15]> (if nil 4 7) 7 [15]> (if 0.0 4 7) 4 [15]> (if "" 4 7) 4 [15]> (if nil 4 7) 7 [15]> (if () 4 7) 7 [15]> (equal 'x 'x) T [15]> (eq 'x 'x) T [15]> (eq 5 5) T [15]> (= 5 5) T [15]> (= 'x 'x) ERROR [16]> (= 0.5 1/2) T [16]> (eq 0.5 1/2) NIL [16]> 'x X [8]> (eq "ola" "ola") NIL [8]> (equal "ola" "ola") T [8]> (equal 'ola 'ola) T [8]> (eq 'ola 'ola) T [8]> (equal 'ola 'ola) T [8]> (eq 'ola 'ola) T [8]> (eq '(ola) '(ola)) NIL [8]> (equal '(ola) '(ola)) T [8]> (let ((x 1) y) (setq y x) y) 1 [8]> y *** - EVAL: variable Y has no value [9]> map 'string #'(lambda (x y) (char "01234567890ABCDEF" (mod (+ x y) 16))) '(1 2 3 4) '(10 9 8 7)) "AAAA" [10]> (setq seq '("lower" "UPPER" "" "123")) ("lower" "UPPER" "" "123") (map nil #'nstring-upcase seq) => NIL seq => ("LOWER" "UPPER" "" "123") (map 'list #'- '(1 2 3 4)) => (-1 -2 -3 -4) (map 'string #'(lambda (x) (if (oddp x) #\1 #\0)) '(1 2 3 4)) => "1010" (map '(vector * 4) #'cons "abc" "de") should signal an error [16]> (setq x (lambda (y) (+ 1 y))) # [17]> (mapcar x '(1 2 3 4)) (2 3 4 5) [17]> (mapcar 'sin '(1 2 3 4)) (0.84147096 0.9092974 0.14112 -0.7568025) [42]> (map 'list (lambda (x) (if (= 2 x) #\o #\1)) '(1 2 3 4)) (#\1 #\o #\1 #\1) [42]> (map 'string (lambda (x) (if (= 2 x) #\o #\1)) '(1 2 3 4)) "1o11" [42]> (map 'nil (lambda (x) (if (= 2 x) #\o #\1)) '(1 2 3 4)) NIL [43]> (find 'A '((B) (C D E) (A F G H I)) :key #'first) (A F G H I) Break 51 [53]> (setq x (lambda (y) (+ 1 y))) # Break 51 [53]> (funcall x 2) 3 [53]> (mapcar x '(1 2 3)) (2 3 4) [69]> (defun f (x) (cond ((numberp x) (+ 1 x)) ((atom x) x) (t (mapcar 'f x)))) F [69]> (f '( 1 2 3)) (2 3 4) [69]> (f '( 1 2 3 x y z)) (2 3 4 X Y Z) [69]> (f '( 1 2 3 x y z (2 3 t ()))) (2 3 4 X Y Z (3 4 T NIL)) [69]> (remove 'a '(a b c a da f d a)) (B C DA F D) [81]> (setq x (lambda (a b) (+ a b))) # [81]> (mapcar x '(1 1) '(3 4)) (4 5)[1]> (setq a (open "ola.txt")) # [2]> (read a) 8 [3]> (read a) 9 [4]> (read a) 0 [5]> (read a) OLA [6]> (read a) MA [7]> (read a) KOLA [8]> (read a) (+ 2 3) [9]> (read) (+ 2 3) (+ 2 3) [10]> (setq input (read)) (+ 1 2 3) (+ 1 2 3) [11]> (eval input) 6