fork download
  1. (defun remove (elem array)
  2. (cond
  3. ((null array) nil)
  4. ((eql elem (car array)) (cdr array))
  5. (t (cons (car array) (remove elem (cdr array))))
  6. )
  7. )
  8.  
  9. (defun pair (elem array)
  10. (list elem (remove elem array))
  11. )
  12.  
  13. (defun pairs (array elems)
  14. (cond
  15. ((null elems) nil)
  16. (t (cons (pair (car elems) array) (pairs array (cdr elems))))
  17. )
  18. )
  19.  
  20. (print (pairs '(1 2) '(1 2)))
Success #stdin #stdout #stderr 0.02s 10228KB
stdin
Standard input is empty
stdout
((1 (2)) (2 (1))) 
stderr
Warning: reserving address range 0x80000c0000...0x1fffffffffff that contains memory mappings. clisp might crash later!
Memory dump:
  0x8000000000 - 0x80000bffff
  0x154824a00000 - 0x154824ce4fff
  0x154824e15000 - 0x154824e39fff
  0x154824e3a000 - 0x154824facfff
  0x154824fad000 - 0x154824ff5fff
  0x154824ff6000 - 0x154824ff8fff
  0x154824ff9000 - 0x154824ffbfff
  0x154824ffc000 - 0x154824ffffff
  0x154825000000 - 0x154825002fff
  0x154825003000 - 0x154825201fff
  0x154825202000 - 0x154825202fff
  0x154825203000 - 0x154825203fff
  0x154825280000 - 0x15482528ffff
  0x154825290000 - 0x1548252c3fff
  0x1548252c4000 - 0x1548253fafff
  0x1548253fb000 - 0x1548253fbfff
  0x1548253fc000 - 0x1548253fefff
  0x1548253ff000 - 0x1548253fffff
  0x154825400000 - 0x154825403fff
  0x154825404000 - 0x154825603fff
  0x154825604000 - 0x154825604fff
  0x154825605000 - 0x154825605fff
  0x1548256be000 - 0x1548256c1fff
  0x1548256c2000 - 0x1548256c2fff
  0x1548256c3000 - 0x1548256c4fff
  0x1548256c5000 - 0x1548256c5fff
  0x1548256c6000 - 0x1548256c6fff
  0x1548256c7000 - 0x1548256c7fff
  0x1548256c8000 - 0x1548256d5fff
  0x1548256d6000 - 0x1548256e3fff
  0x1548256e4000 - 0x1548256f0fff
  0x1548256f1000 - 0x1548256f4fff
  0x1548256f5000 - 0x1548256f5fff
  0x1548256f6000 - 0x1548256f6fff
  0x1548256f7000 - 0x1548256fcfff
  0x1548256fd000 - 0x1548256fefff
  0x1548256ff000 - 0x1548256fffff
  0x154825700000 - 0x154825700fff
  0x154825701000 - 0x154825701fff
  0x154825702000 - 0x15482572ffff
  0x154825730000 - 0x15482573efff
  0x15482573f000 - 0x1548257e4fff
  0x1548257e5000 - 0x15482587bfff
  0x15482587c000 - 0x15482587cfff
  0x15482587d000 - 0x15482587dfff
  0x15482587e000 - 0x154825891fff
  0x154825892000 - 0x1548258b9fff
  0x1548258ba000 - 0x1548258c3fff
  0x1548258c4000 - 0x1548258c5fff
  0x1548258c6000 - 0x1548258cbfff
  0x1548258cc000 - 0x1548258cefff
  0x1548258d1000 - 0x1548258d1fff
  0x1548258d2000 - 0x1548258d2fff
  0x1548258d3000 - 0x1548258d3fff
  0x1548258d4000 - 0x1548258d4fff
  0x1548258d5000 - 0x1548258d5fff
  0x1548258d6000 - 0x1548258dcfff
  0x1548258dd000 - 0x1548258dffff
  0x1548258e0000 - 0x1548258e0fff
  0x1548258e1000 - 0x154825901fff
  0x154825902000 - 0x154825909fff
  0x15482590a000 - 0x15482590afff
  0x15482590b000 - 0x15482590bfff
  0x15482590c000 - 0x15482590cfff
  0x55c2e2c13000 - 0x55c2e2d03fff
  0x55c2e2d04000 - 0x55c2e2e0dfff
  0x55c2e2e0e000 - 0x55c2e2e6dfff
  0x55c2e2e6f000 - 0x55c2e2e9dfff
  0x55c2e2e9e000 - 0x55c2e2ecefff
  0x55c2e2ecf000 - 0x55c2e2ed2fff
  0x55c2e4597000 - 0x55c2e45b7fff
  0x7ffc4954b000 - 0x7ffc4956bfff
  0x7ffc495dc000 - 0x7ffc495dffff
  0x7ffc495e0000 - 0x7ffc495e1fff
WARNING: DEFUN/DEFMACRO(REMOVE): #<PACKAGE COMMON-LISP> is locked
         Ignore the lock and proceed
WARNING: DEFUN/DEFMACRO: redefining function REMOVE in /home/UpnidO/prog.lisp,
         was defined in C