LISP 37
NOT ORGANZED lisp from november 4th Guest on 22nd November 2021 06:18:21 PM
  1. ;; This buffer is for text that is not saved, and for Lisp evaluation.
  2. ;; To create a file, visit it with C-x C-f and enter text in its buffer.
  3.  
  4. '(1 2 3)
  5.  
  6. (quote (1 2 3))
  7.  
  8. '(a b c)
  9.  
  10. (atom '(atom 'a))
  11.  
  12. (atom '(3 4 5))
  13.  
  14. (eq 'a 'b)
  15.  
  16. (eq 1 1)
  17.  
  18. (eq '(2 3) '(2 3))
  19.  
  20. (car '(4 5 6))
  21. (cdr '(5 6 7))
  22.  
  23. (cdr '( (2 3) (1 2) (5 6 7)))
  24.  
  25. (cons  '2 '(3 4 5))
  26.  
  27. (cons '(1 2) '(3 4 5))
  28.  
  29. (cond
  30.  ( (eq 'a 'a) '3)
  31.  ((eq '2 '2) '4))
  32.  
  33. (defun double (x)
  34.   (* 2 x))
  35.  
  36. (double 3)
  37.  
  38. (null '())
  39.  
  40. (null '(1))
  41.  
  42. (defun lat (l)
  43.   (cond
  44.    ((null l) t)
  45.    ((atom (car l)) (lat(cdr l)))
  46.    (t nil)
  47.    )
  48.   )
  49.  
  50. (lat '(1 (2 3) 4))
  51.  
  52. (and (atom 2) (atom 'a))
  53.  
  54. (defun eqlist (l1 l2)
  55.   (cond
  56.    ( (and (null l1) (null l2)) t)
  57.    ( (eq (car l1) (car l2)) (eqlist (cdr l1) (cdr l2)))
  58.    (t nil)
  59.    )
  60.   )
  61.  
  62. (eqlist '(1 2 3 4 5) '(1 2 3 4 5))
  63.  
  64. (defun member2 (x l)
  65.   (cond
  66.    ( (null l) nil)
  67.    ( (eq x (car l)) t)
  68.    ( t (member2 x (cdr l)))
  69.    )
  70.   )
  71.  
  72. (member2 '6 '(1 2 3 4 5))
  73.  
  74. (not (eq 2 2))
  75.  
  76. (defun nonlat (l)
  77.   (cond
  78.    ( (null l) t)
  79.    ( (not (atom (car l))) (nonlat (cdr l)))
  80.    ( t nil)
  81.    )
  82.   )
  83.  
  84. (nonlat '(1 2 3))
  85. (nonlat '((2 3) 4 5 (5)))

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.