;; Dribble of # started on 2012-05-23 19:17:57. # [4]> (mapcar '1+ (1 3 5 6 8)) *** - EVAL: 1 is not a function name; try using a symbol instead The following restarts are available: USE-VALUE :R1 Input a value to be used instead. ABORT :R2 Abort main loop Break 1 [5]> abort [6]> (mapcar #'1+ (1 3 5 6 8)) *** - EVAL: 1 is not a function name; try using a symbol instead The following restarts are available: USE-VALUE :R1 Input a value to be used instead. ABORT :R2 Abort main loop Break 1 [7]> abort [8]> (mapcar 1+ (1 3 5 6 8)) *** - SYSTEM::READ-EVAL-PRINT: variable 1+ has no value The following restarts are available: USE-VALUE :R1 Input a value to be used instead of 1+. STORE-VALUE :R2 Input a new value for 1+. ABORT :R3 Abort main loop Break 1 [9]> abort [10]> (mapcar '1+ '(1 3 5 6 8)) (2 4 6 7 9) [11]> (defun dbl (x) (+ x x)) DBL [12]> (mapcar 'dbl '(1 3 5 6 8)) (2 6 10 12 16) [13]> (mapcar '1+ '(1 3 5 6 8)) (2 4 6 7 9) [14]> (mapcar 'sqrt '(1 3 5 6 8)) (1 1.7320508 2.236068 2.4494898 2.828427) [15]> (mapcar 'sqrt '(1 3 (5 4) 6 8)) *** - SQRT: (5 4) is not a number The following restarts are available: USE-VALUE :R1 Input a value to be used instead. ABORT :R2 Abort main loop Break 1 [16]> abort [17]> (mapcar 'length '(1 3 (5 4) 6 8)) *** - LENGTH: 1 is not a SEQUENCE The following restarts are available: ABORT :R1 Abort main loop Break 1 [18]> abort [19]> (mapcar 'listp '(1 3 (5 4) 6 8)) (NIL NIL T NIL NIL) [20]> (maplist 'listp '(1 3 (5 4) 6 8)) (T T T T T) [21]> (maplist 'null '(1 3 (5 4) 6 8)) (NIL NIL NIL NIL NIL) [22]> (maplist 'length '(1 3 (5 4) 6 8)) (5 4 3 2 1) [23]> (mapcar '+ '(1 2 3) '(4 5 6)) (5 7 9) [24]> (mapcar '+ '(1 2 3) '(4 5 6) '(3 4 5)) (8 11 14) [25]> (mapcar '+ '(1 2 3) '(4 5 6 5) '(3 4 5 7)) (8 11 14) [26]> (mapcar '+ '(1 2 3 4) '(4 5 6 5) '(3 4 5)) (8 11 14) [27]> (mapcar 'cons '(a b c) '(d e f)) ((A . D) (B . E) (C . F)) [28]> (defun func2 (x) (* x x)) FUNC2 [29]> (defun func3 (x) (* x x x)) FUNC3 [30]> *func2 12) *** - SYSTEM::READ-EVAL-PRINT: variable *FUNC2 has no value The following restarts are available: USE-VALUE :R1 Input a value to be used instead of *FUNC2. STORE-VALUE :R2 Input a new value for *FUNC2. ABORT :R3 Abort main loop Break 1 [31]> abort [32]> (func2 12) 144 [33]> (func3 12) 1728 [34]> (defun try1 (fn x) (fn x)) TRY1 [35]> (try1 'func2 12) *** - EVAL: undefined function FN The following restarts are available: USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'FN). RETRY :R2 Retry STORE-VALUE :R3 Input a new value for (FDEFINITION 'FN). ABORT :R4 Abort main loop Break 1 [36]> abort [37]> (defun try1 (fn x) (apply fn x)) TRY1 [38]> (try1 'func2 12) *** - EVAL/APPLY: Too few arguments (0 instead of at least 1) given to FUNC2 The following restarts are available: ABORT :R1 Abort main loop Break 1 [39]> (try1 'func2 (12)) *** - EVAL: 12 is not a function name; try using a symbol instead The following restarts are available: USE-VALUE :R1 Input a value to be used instead. ABORT :R2 Abort debug loop ABORT :R3 Abort main loop Break 2 [40]> abort Break 1 [39]> (try1 'func2 12) *** - EVAL/APPLY: Too few arguments (0 instead of at least 1) given to FUNC2 The following restarts are available: ABORT :R1 Abort debug loop ABORT :R2 Abort main loop Break 2 [41]> (try1 'func2 '(12)) 144 Break 2 [41]> (try1 'func2 '(12)) 144 Break 2 [41]> (defun try1 (fn x) (apply fn (list x))) TRY1 Break 2 [41]> (try1 'func2 12) 144 Break 2 [41]> (defun try1 (fnx x) (apply fnx (list x))) TRY1 Break 2 [41]> (try1 'func2 122) 14884 Break 2 [41]> (defun try1 (fnx x) (funcall fnx x)) TRY1 Break 2 [41]> (try1 'func2 122) 14884 Break 2 [41]> (apply '+ '(1 2 3)) 6 Break 2 [41]> (+ 1 2 3) 6 Break 2 [41]> (funcall '+ 1 2 3) 6 Break 2 [41]> (mapcar '1+ '(1 2 3)) (2 3 4) Break 2 [41]> (apply '+ '(1 2 3)) 6 Break 2 [41]> (defun try2 (fnx fny x) (funcall fny (funcall fnx x))) TRY2 Break 2 [41]> (try2 'sqrt '1+ 3) 2.732051 Break 2 [41]> (try2 '1+ 'sqrt 3) 2 Break 2 [41]> (defun try2 (fnx fny x) (funcall fny (apply fnx x))) TRY2 Break 2 [41]> (try2 '+ 'sqrt '(1 2 3 4 5)) 3.8729835 Break 2 [41]> (try2 '+ 'func3 '(1 2 3 4 5)) 3375 Break 2 [41]> (defun try2 (fnz fny fnx x) (funcall fny (apply fnx (mapcar fnz x)))) TRY2 Break 2 [41]> (try2 'func2 '+ 'sqrt '(1 2 3 4 5)) *** - APPLY: too many arguments given to SQRT The following restarts are available: ABORT :R1 Abort debug loop ABORT :R2 Abort debug loop ABORT :R3 Abort main loop Break 3 [42]> (try2 'func2 'sqrt '+ '(1 2 3 4 5)) 7.4161983 Break 3 [42]> (try2 'func3 'func2 '+ '(1 2 3 4 5)) 50625 Break 3 [42]> (try2 'func3 'func2 '* '(1 2 3 4 5)) 2985984000000 Break 3 [42]> (+ '(1 2 3 4)) *** - +: (1 2 3 4) is not a number The following restarts are available: USE-VALUE :R1 Input a value to be used instead. ABORT :R2 Abort debug loop ABORT :R3 Abort debug loop ABORT :R4 Abort debug loop ABORT :R5 Abort main loop Break 4 [43]> abort Break 3 [42]> abort Break 2 [41]> abort Break 1 [39]> abort [44]> (apply '+ '(1 2 3 4)) 10 [45]> (defun xx (n f op) (cond You are in the top-level Read-Eval-Print loop. Help (abbreviated :h) = this list Use the usual editing capabilities. (quit) or (exit) leaves CLISP. ((eql n 1) 1) You are in the top-level Read-Eval-Print loop. Help (abbreviated :h) = this list Use the usual editing capabilities. (quit) or (exit) leaves CLISP. (t (funcall op (funcall f n) (xx (1- n)))) You are in the top-level Read-Eval-Print loop. Help (abbreviated :h) = this list Use the usual editing capabilities. (quit) or (exit) leaves CLISP. )) XX [46]> You are in the top-level Read-Eval-Print loop. Help (abbreviated :h) = this list Use the usual editing capabilities. (quit) or (exit) leaves CLISP. (defun xx (n f op) (cond ((eql n 1) 1) (t (funcall op (funcall f n) (xx (1- n)))) )) XX [47]> (sqr 4) *** - EVAL: undefined function SQR The following restarts are available: USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'SQR). RETRY :R2 Retry STORE-VALUE :R3 Input a new value for (FDEFINITION 'SQR). ABORT :R4 Abort main loop Break 1 [48]> abort [49]> (xx 5 'func2 '+) *** - EVAL/APPLY: Too few arguments (1 instead of at least 3) given to XX The following restarts are available: ABORT :R1 Abort main loop Break 1 [50]> abort [51]> (defun xx (n f op) (cond ((eql n 1) 1) (t (funcall op (funcall f n) (xx (1- n) f op))) )) XX [52]> (xx 5 'func2 '+) 55 [53]> (xx 10 'func2 '+) 385 [54]> (xx 10 'func3 '+) 3025 [55]> (defun func1 (x) x) FUNC1 [56]> (xx 10 'func1 '+) 55 [57]> (xx 10 'func1 '*) 3628800 [58]> (defun func1b (x) (+ x y)) FUNC1B [59]> (func1b 4) *** - FUNC1B: variable Y has no value The following restarts are available: USE-VALUE :R1 Input a value to be used instead of Y. STORE-VALUE :R2 Input a new value for Y. ABORT :R3 Abort main loop Break 1 [60]> (setq y 33) 33 Break 1 [60]> (func1b 4) 37 Break 1 [60]> (defun func1b (x) (+ x y)) FUNC1B Break 1 [60]> abort [61]> (+ 2 3 4) 9 [62]> '(+ 2 3 4) (+ 2 3 4) [63]> (eval '(+ 3 4 4)) 11 [64]> (setq v '(+ 4 5 6 7)) (+ 4 5 6 7) [65]> v (+ 4 5 6 7) [66]> (eval v) 22 [67]> (apply '1+ (2)) *** - EVAL: 2 is not a function name; try using a symbol instead The following restarts are available: USE-VALUE :R1 Input a value to be used instead. ABORT :R2 Abort main loop Break 1 [68]> abort [69]> (apply '1+ '(2)) 3 [70]> (apply (lambda (q) (+ (* q q q) q) '(2)) ) *** - EVAL: too few arguments given to APPLY: (APPLY (LAMBDA (Q) (+ (* Q Q Q) Q) '(2))) The following restarts are available: ABORT :R1 Abort main loop Break 1 [71]> (apply (lambda (q) (+ (* q q q) q)) '(2)) 10 Break 1 [71]> (apply #'(lambda (q) (+ (* q q q) q)) '(2)) 10 Break 1 [71]> abort [72]> (apply (lambda (q) (+ (* q q q) q)) '(2)) 10 [73]> (apply #'(lambda (q) (+ (* q q q) q)) '(2)) 10 [74]> (mapcar #'(lambda (q) (+ (* q q q) q)) '(2 3 4 5 6)) (10 30 68 130 222) [75]> (mapcar (lambda (q) (+ (* q q q) q)) '(2 3 4 5 6)) (10 30 68 130 222) [76]> (#'(lambda (q) (+ (* q q q) q)) 2) *** - EVAL: #'(LAMBDA (Q) (+ (* Q Q Q) Q)) is not a function name; try using a symbol instead The following restarts are available: USE-VALUE :R1 Input a value to be used instead. ABORT :R2 Abort main loop Break 1 [77]> abort [78]> (xx 10 (lambda (a) (* a a)) '+) 385 [79]> (xx 10 (lambda (a) (* a a a a)) '+) 25333 [80]> (defun xyz (a b) (+ a b)) XYZ [81]> (xyz 2 3) 5 [82]> (xyz 2) *** - EVAL/APPLY: Too few arguments (1 instead of at least 2) given to XYZ The following restarts are available: ABORT :R1 Abort main loop Break 1 [83]> abort [84]> (defun xyz (a &optional (b 3)) (+ a b)) XYZ [85]> (xyz 2) 5 [86]> (defun xyz (a &optional (b 3)) (+ a b)) XYZ [87]> (defmacro mac1 (a b) (list a b)) MAC1 [88]> (mac1 2 3) *** - EVAL: 2 is not a function name; try using a symbol instead The following restarts are available: USE-VALUE :R1 Input a value to be used instead. ABORT :R2 Abort main loop Break 1 [89]> abort [90]> ((2 3)) *** - EVAL: (2 3) is not a function name; try using a symbol instead The following restarts are available: USE-VALUE :R1 Input a value to be used instead. ABORT :R2 Abort main loop Break 1 [91]> abort [92]> (2 3) *** - EVAL: 2 is not a function name; try using a symbol instead The following restarts are available: USE-VALUE :R1 Input a value to be used instead. ABORT :R2 Abort main loop Break 1 [93]> abort [94]> (list 2 3) (2 3) [95]> (print mac1) *** - SYSTEM::READ-EVAL-PRINT: variable MAC1 has no value The following restarts are available: USE-VALUE :R1 Input a value to be used instead of MAC1. STORE-VALUE :R2 Input a new value for MAC1. ABORT :R3 Abort main loop Break 1 [96]> abort [97]> (print (mac1 2 3)) *** - EVAL: 2 is not a function name; try using a symbol instead The following restarts are available: USE-VALUE :R1 Input a value to be used instead. ABORT :R2 Abort main loop Break 1 [98]> abort [99]> (print (mac1 1+ 3)) 4 4 [100]> (defmacro rad(ls) `caddr ls)) RAD [101]> *** - READ from # # #> # #>>> : an object cannot start with #\) The following restarts are available: ABORT :R1 Abort main loop Break 1 [102]> abort [103]> (defmacro rad(ls) 'caddr ls)) RAD [104]> *** - READ from # # #> # #>>> : an object cannot start with #\) The following restarts are available: ABORT :R1 Abort main loop Break 1 [105]> abort [106]> (defmacro rad(ls) 'caddr ls)) RAD [107]> *** - READ from # # #> # #>>> : an object cannot start with #\) The following restarts are available: ABORT :R1 Abort main loop Break 1 [108]> abort [109]> (apply 'mapcar 'list '((a b c) (d e f)(g h k))) ((A D G) (B E H) (C F K)) [110]> (apply 'mapcar 'list '((a 3 b c) (d 4 e f)(g h 4 k))) ((A D G) (3 4 H) (B E 4) (C F K)) [111]> (defun transpose (matrix)(apply 'mapcar 'list matrix) ) TRANSPOSE [112]> (reduce '+ '(1 2 3 4)) 10 [113]> (apply '+ '(1 2 3 4)) 10 [114]> (apply 'mapcar '* '((1 2 3 4)(5 6 7 8)) ) (5 12 21 32) [115]> (reduce '+ (apply 'mapcar '* '((1 2 3 4)(5 6 7 8)) )) 70 [116]> (reduce '+ (mapcar '* '(1 2 3 4) '(5 6 7 8) )) 70 [117]> (defun comp (g f x) (funcall g (funcall f x))) COMP [118]> (exp 2) 7.389056 [119]> (defun 5+ (x) (+ x 5)) 5+ [120]> (comp 'exp '5+ 3) 2980.958 [121]> (comp 'exp 'sqrt 3) 5.6522336 [122]> (+ 3 4) 7 [123]> (mapcar '+ '(2 3 4 5)) (2 3 4 5) [124]> (mapcar '/ '(2 3 4 5)) (1/2 1/3 1/4 1/5) [125]> (mapcar '* '(2 3 4 5)) (2 3 4 5) [126]> (mapcar '* '(2 3 4 5)) (2 3 4 5) [127]> (defun myfunc2 (a b) (+ a a b)) MYFUNC2 [128]> (myfunc2 1 2) 4 [129]> (myfunc2 1) *** - EVAL/APPLY: Too few arguments (1 instead of at least 2) given to MYFUNC2 The following restarts are available: ABORT :R1 Abort main loop Break 1 [130]> abort [131]> (mapcar 'myfunc2 '(1 2 4 56)) *** - EVAL/APPLY: Too few arguments (1 instead of at least 2) given to MYFUNC2 The following restarts are available: ABORT :R1 Abort main loop Break 1 [132]> (mapcar 'myfunc2 '(1 2 4 56) (3 3 3 3)) *** - EVAL: 3 is not a function name; try using a symbol instead The following restarts are available: USE-VALUE :R1 Input a value to be used instead. ABORT :R2 Abort debug loop ABORT :R3 Abort main loop Break 2 [133]> abort Break 1 [132]> abort [134]> (mapcar 'myfunc2 '(1 2 4 56) '(3 3 3 3)) (5 7 11 115) [135]> (mapcar 'myfunc2 '(1 2 4 56) '(3 3 3 3)) (5 7 11 115) [136]> (load "c:/lisp/functionals.txt") ;; Loading file C:\lisp\functionals.txt ... WARNING: DEFUN/DEFMACRO: redefining function COMP in C:\lisp\functionals.txt, was defined in top-level ;; Loaded file C:\lisp\functionals.txt T [137]> (bu 2 2) # [138]> (mapcar (bu 'myfunc2 3) '(1 2 4 56)) (7 8 10 62) [139]> (dribble) ;; Dribble of # finished on 2012-05-23 22:03:51.