Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- user@FinnandthethreeFurys ~
- $ 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-17) <http://clisp.org/>
- 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]> (position 'x '(x y z))
- 0
- [2]> (member 'z '(x y z))
- (Z)
- [3]> (member 'z '(x y))
- NIL
- [4]> #'isevenp
- *** - FUNCTION: undefined function ISEVENP
- The following restarts are available:
- USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'ISEVENP).
- RETRY :R2 Retry
- STORE-VALUE :R3 Input a new value for (FDEFINITION 'ISEVENP).
- ABORT :R4 Abort main loop
- Break 1 [5]> :R4
- [6]> #'evenp
- #<SYSTEM-FUNCTION EVENP>
- [7]> (evenp 2)
- T
- [8]> (map #'evenp '(2 3 4 5 6 7 8))
- *** - EVAL: too few arguments given to MAP: (MAP #'EVENP '(2 3 4 5 6 7 8))
- The following restarts are available:
- ABORT :R1 Abort main loop
- Break 1 [9]> ABORT
- [10]> (map 'list #'evenp '(2 3 4 5 6 7 8))
- (T NIL T NIL T NIL T)
- [11]> (map 'boolean #'evenp '(2 3 4 5 6 7 8))
- *** - There are no sequences of type BOOLEAN
- The following restarts are available:
- ABORT :R1 Abort main loop
- Break 1 [12]> ABORT
- [13]> (map 'bool #'evenp '(2 3 4 5 6 7 8))
- *** - There are no sequences of type BOOL
- The following restarts are available:
- ABORT :R1 Abort main loop
- Break 1 [14]> ABORT
- [15]> ABORT
- *** - SYSTEM::READ-EVAL-PRINT: variable ABORT has no value
- The following restarts are available:
- USE-VALUE :R1 Input a value to be used instead of ABORT.
- STORE-VALUE :R2 Input a new value for ABORT.
- ABORT :R3 Abort main loop
- Break 1 [16]> ABORT
- [17]> (map t #'evenp '(2 3 4 5 6 7 8))
- *** - There are no sequences of type T
- The following restarts are available:
- ABORT :R1 Abort main loop
- Break 1 [18]> ABORT
- [19]> (map nil #'evenp '(2 3 4 5 6 7 8))
- NIL
- [20]> (map null #'evenp '(2 3 4 5 6 7 8))
- *** - SYSTEM::READ-EVAL-PRINT: variable NULL has no value
- The following restarts are available:
- USE-VALUE :R1 Input a value to be used instead of NULL.
- STORE-VALUE :R2 Input a new value for NULL.
- ABORT :R3 Abort main loop
- Break 1 [21]> ABORT
- [22]> (map 'null #'evenp '(2 3 4 5 6 7 8))
- *** - MAP: sequence type forces length 0, but result has length 7
- The following restarts are available:
- ABORT :R1 Abort main loop
- Break 1 [23]> ABORT
- [24]> (map 'list #'evenp '(2 3 4 5 6 7 8))
- (T NIL T NIL T NIL T)
- [25]> (find nil (map 'list (lambda (n) (if (= (mod n 3) 0) nil t))))
- *** - EVAL: too few arguments given to MAP:
- (MAP 'LIST (LAMBDA (N) (IF (= (MOD N 3) 0) NIL T)))
- The following restarts are available:
- ABORT :R1 Abort main loop
- Break 1 [26]> abort
- [27]> (find nil (map 'list (lambda (n) (if (= (mod n 3) 0) nil t)) '(2 3 4 5 6 7 8 9)))
- NIL
- [28]> (map 'list (lambda (n) (if (= (mod n 3) 0) nil t)) '(2 3 4 5 6 7 8 9))
- (T NIL T T NIL T T NIL)
- [29]> (find t (map 'list (lambda (n) (if (= (mod n 3) 0) nil t)) '(2 3 4 5 6 7 8 9)))
- T
- [30]> (member t (map 'list (lambda (n) (if (= (mod n 3) 0) nil t)) '(2 3 4 5 6 7 8 9)))
- (T NIL T T NIL T T NIL)
- [31]> (find t (map 'list (lambda (n) (if (= (mod n 3) 0) nil t)) '(2 3 4 5 6 7 8 9)))
- T
- [32]> (defun ook (i) (find t (map 'list (lambda (n) (if (= (mod n i) 0) nil t)) '(2 3 4 5 6 7 8 9 10))))
- OOK
- [33]> (ook 3)
- T
- [34]> (ook 4)
- T
- [35]> (defun ook (i) (find t (map 'list (lambda (n) (if (= (mod n i) 0) nil t)) '(2 3 4 5 6 7 8 9 10))))
- OOK
- [36]> (ook 20)
- T
- [37]> (defun ook (i) (find t (map 'list (lambda (n) (if (= (mod i n) 0) nil t)) '(2 3 4 5 6 7 8 9 10))))
- OOK
- [38]> (ook 20)
- T
- [39]> (defun ook (i lis) (find t (map 'list (lambda (n) (if (= (mod i n) 0) nil t)) lis)))
- OOK
- [40]> (ook 3 '(4 5))
- T
- [41]> (ook 3 '(4 6))
- T
- [42]> (ook 3 '(3 6))
- T
- [43]> (ook 3 '())
- NIL
- [44]> (defun ook (i lis) (map 'list (lambda (n) (if (= (mod i n) 0) nil t)) lis))
- OOK
- [45]> (ook 3 '(3 6))
- (NIL T)
- [46]> (ook 3 '(4 6))
- (T T)
- [47]> (defun ook (i lis) (find t (map 'list (lambda (n) (if (= (mod i n) 0) t nil)) lis)))
- OOK
- [48]> (ook 3 '(3 6))
- T
- [49]> (ook 3 '(4 5))
- NIL
- [50]> (defun frodo (divs lis) (find t (map 'list (lambda (n) (if (ook n lis) t nil)) lis))
- )
- FRODO
- [51]> (frodo '(3 5) '(1 2))
- T
- [52]> (frodo '(3 5) '(3 5))
- T
- [53]> (frodo '(3 5) '(6 10))
- T
- [54]> (defun frodo (divs lis) (map 'list (lambda (n) (if (ook n lis) t nil)) lis))
- FRODO
- [55]> (frodo '(3 5) '(6 10))
- (T T)
- [56]> (frodo '(3 5) '(1))
- (T)
- [57]> (defun frodo (divs lis) (map 'list (lambda (n) (ook n lis)) lis)) FRODO
- [58]> (frodo '(3 5) '(1))
- (T)
- [59]> (frodo '(3 5) '(20))
- (T)
- [60]> (defun frodo (divs lis) (map 'list (lambda (n) (if (ook n lis) t nil)) divs))
- FRODO
- [61]> (frodo '(3 5) '(20))
- (NIL NIL)
- [62]> (defun frodo (divs lis) (find t (map 'list (lambda (n) (if (ook n lis) t nil)) divs)))
- FRODO
- [63]> (frodo '(3 5) '(20))
- NIL
- [64]> (frodo '(3 5) '(3 5))
- T
- [65]> (frodo '(3 5) '(1 3 5 7 11))
- T
- [66]> (defun frodo (divs lis) (map 'list (lambda (n) (if (ook n lis) t nil)) divs))
- FRODO
- [67]> (frodo '(3 5) '(1 3 5 7 11)) (T T)
- [68]> (defun frodo (divs lis) (map 'list (lambda (n) (ook n lis)) divs)) FRODO
- [69]> (frodo '(3 5) '(1 3 5 7 11))
- (T T)
- [70]> (defun ook (i lis) (find-if-not nil (map 'list (lambda (n) (if (= (mod i n) 0) n nil)) lis)))
- OOK
- [71]> (ook 3 '(2 3 5))
- *** - FUNCALL: undefined function NIL
- The following restarts are available:
- USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'NIL).
- RETRY :R2 Retry
- STORE-VALUE :R3 Input a new value for (FDEFINITION 'NIL).
- ABORT :R4 Abort main loop
- Break 1 [72]> ABORT
- [73]> #'nilp
- *** - FUNCTION: undefined function NILP
- The following restarts are available:
- USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'NILP).
- RETRY :R2 Retry
- STORE-VALUE :R3 Input a new value for (FDEFINITION 'NILP).
- ABORT :R4 Abort main loop
- Break 1 [74]> ABORT
- [75]> #'isnil
- *** - FUNCTION: undefined function ISNIL
- The following restarts are available:
- USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'ISNIL).
- RETRY :R2 Retry
- STORE-VALUE :R3 Input a new value for (FDEFINITION 'ISNIL).
- ABORT :R4 Abort main loop
- Break 1 [76]> abort
- [77]> (defun ook (i lis) (find-if-not #'not (map 'list (lambda (n) (if (= (mod i n) 0) n nil)) lis)))
- OOK
- [78]> (ook 3 '(2 3 5))
- 3
- [79]> (ook 3 '(2 5))
- NIL
- [80]> (ook 3 '(2 3 5 9))
- 3
- [81]> (defun ook (i lis) (map 'list (lambda (n) (if (= (mod i n) 0) n nil)) lis))
- OOK
- [82]> (ook 3 '(2 3 5 9))
- (NIL 3 NIL NIL)
- [83]> (defun ook (i lis) (remove nil (map 'list (lambda (n) (if (= (mod i n) 0) n nil)) lis)))
- OOK
- [84]> (ook 3 '(2 3 5 9))
- (3)
- [85]> (frodo '(3 5) '(1 3 5 7 11)) ((1 3) (1 5))
- [86]> (union (frodo '(3 5) '(1 3 5 7 11)))
- *** - EVAL: too few arguments given to UNION:
- (UNION (FRODO '(3 5) '(1 3 5 7 11)))
- The following restarts are available:
- ABORT :R1 Abort main loop
- Break 1 [87]> ABORT
- [88]> abort
- *** - SYSTEM::READ-EVAL-PRINT: variable ABORT has no value
- The following restarts are available:
- USE-VALUE :R1 Input a value to be used instead of ABORT.
- STORE-VALUE :R2 Input a new value for ABORT.
- ABORT :R3 Abort main loop
- Break 1 [89]> abort
- [90]> (union (frodo '(3 5) '(1 3 5 7 11)) (frodo '(3 5) '(1 3 5 7 11)))
- ((1 3) (1 5) (1 3) (1 5))
- [91]> (union (cdr (frodo '(3 5) '(1 3 5 7 11))) (cdr (frodo '(3 5) '(1 3 5 7 11))))
- ((1 5) (1 5))
- [92]> (remove-duplicates (frodo '(3 5) '(1 3 5 7 11)))
- ((1 3) (1 5))
- [93]> (frodo '(3 5) '(1 3 5 7 11))
- ((1 3) (1 5))
- [94]> (union ,@(frodo '(3 5) '(1 3 5 7 11)))
- *** - READ: comma is illegal outside of backquote
- The following restarts are available:
- ABORT :R1 Abort main loop
- Break 1 [95]> abort
- [96]> `(union ,@(frodo '(3 5) '(1 3 5 7 11)))
- (UNION (1 3) (1 5))
- [97]> (defmacro unpack (f lis)
- `(f ,@lis))
- UNPACK
- [98]> (unpack #'union (frodo '(3 5) '(1 3 5 7 11)))
- *** - EVAL: undefined function F
- The following restarts are available:
- USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'F).
- RETRY :R2 Retry
- STORE-VALUE :R3 Input a new value for (FDEFINITION 'F).
- ABORT :R4 Abort main loop
- Break 1 [99]> abort
- [100]> (defmacro unpack-join (lis)
- `(union ,@lis))
- UNPACK-JOIN
- [101]> (unpack-join (frodo '(3 5) '(1 3 5 7 11)))
- *** - SYSTEM::READ-EVAL-PRINT: variable FRODO has no value
- The following restarts are available:
- USE-VALUE :R1 Input a value to be used instead of FRODO.
- STORE-VALUE :R2 Input a new value for FRODO.
- ABORT :R3 Abort main loop
- Break 1 [102]> abort
- [103]> (unpack-join '(frodo '(3 5) '(1 3 5 7 11)))
- *** - SYSTEM::READ-EVAL-PRINT: variable QUOTE has no value
- The following restarts are available:
- USE-VALUE :R1 Input a value to be used instead of QUOTE.
- STORE-VALUE :R2 Input a new value for QUOTE.
- ABORT :R3 Abort main loop
- Break 1 [104]> abort
- [105]> #'defvar
- *** - FUNCTION: undefined function DEFVAR
- The following restarts are available:
- USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'DEFVAR).
- RETRY :R2 Retry
- STORE-VALUE :R3 Input a new value for (FDEFINITION 'DEFVAR).
- ABORT :R4 Abort main loop
- Break 1 [106]> abort
- [107]>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement