;; Dribble of # started on NIL. # [3]> (defmacro setq2 (var val) (list 'set (list 'quote var) val)) SETQ2 [4]> (setq2 qq 4) 4 [5]> qq 4 [6]> (macroexpand '(setq2 qq 4)) (SET 'QQ 4) ; T [7]> (+ 1 44 55 66 77) 243 [8]> (reduce '+ '(1 44 55 66 77)) 243 [9]> (reduce '* '(1 44 55 66 77)) 12298440 [10]> (load "c:/lisp/frunctionals.lsp") *** - LOAD: A file with name C:\lisp\frunctionals.lsp does not exist The following restarts are available: ABORT :R1 Abort main loop Break 1 [11]> abort [12]> (load "c:/lisp/functionals.lsp") ;; Loading file C:\lisp\functionals.lsp ... ;; Loaded file C:\lisp\functionals.lsp T [13]> (trans '((3 4 5)(6 7 8)) ) ((3 6) (4 7) (5 8)) [14]> (mapcar '* (trans '((3 4 5)(6 7 8)))) *** - *: (3 6) 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 [15]> abort [16]> (mapcar '1+ '(1 2 3)) (2 3 4) [17]> (mapcar '(bu '+ 3) '(1 2 3)) *** - FUNCALL: (BU '+ 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 [18]> abort [19]> (mapcar (bu '+ 3) '(1 2 3)) (4 5 6) [20]> (mapcar (bu '+ 6) '(1 2 3)) (7 8 9) [21]> (mapcar 'cons '(1 2 3) '4 5 6)) *** - MAPCAR: A proper list must not end with 4 The following restarts are available: ABORT :R1 Abort main loop Break 1 [22]> abort [23]> (mapcar 'cons '(1 2 3) '(4 5 6)) ((1 . 4) (2 . 5) (3 . 6)) [24]> (mapcar 'cons '(1 2 3) '(7 7 7)) ((1 . 7) (2 . 7) (3 . 7)) [25]> (mapcar 'cons '(7 7 7) '(1 2 3)) ((7 . 1) (7 . 2) (7 . 3)) [26]> (mapcar (bu 'cons 7) '(1 2 3)) ((7 . 1) (7 . 2) (7 . 3)) [27]> (mapcar (bu (rev 'cons) 7) '(1 2 3)) ((1 . 7) (2 . 7) (3 . 7)) [28]> (defun f (x) (1+ (* x x))) F [29]> (f 5) 26 [30]> (defun g (x) (sqrt x)) G [31]> (g 9) 3 [32]> (mapcar (comp 'g 'f) '(4 7 8 9)) (4.1231055 7.071068 8.062258 9.055386) [33]> Bye.