Advertisement
osipyonok

lab3 input

Dec 1st, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.15 KB | None | 0 0
  1. (cond
  2.     ((atom z) (cond
  3.                 ((eq z y) x)
  4.                 (t z)))
  5.     (t (cons (subst x y (car z))
  6.              (subst x y (cdr z))))))
  7.  
  8. (defun test(and x y)
  9.     (cond
  10.       (x y)
  11.       (t nil)))
  12. (defun sum (n1 n2 n3 n4)
  13.     (+ n1 n2 n3 n4))
  14. (defun abo(or x y)
  15.     (cond
  16.       (x t)
  17.       (t y)))
  18. (defun ni(not x)
  19.     (cond
  20.       (x nil)
  21.       (t t)))
  22.  
  23. (defun aaa(weirdo p q)
  24.     (cond
  25.       (p q)
  26.       (t t)))
  27.  
  28. (defun (equal x y)
  29.     (or (and (atom x) (atom y) (eq x y))
  30.      (and (not (atom x)) (not (atom y))
  31.           (equal (car x) (car y))
  32.           (equal (cdr x) (cdr y)))))
  33.  
  34.  
  35. ;; etc.
  36.  
  37. (defun eee(list a b c)
  38.     (cons a (cons b (cons c nil))))
  39.  
  40. (defun fun(append x y)
  41.     (cond
  42.       ((null x) y)
  43.       (t (cons (car x)
  44.                (append (cdr x) y)))))
  45.  
  46. (defun fun2(apply f args)
  47.     (eval (cons f (appq args)) nil))
  48.  
  49. (defun f(appq m)
  50.     (cond
  51.       ((null m) nil)
  52.       (t (cons (list 'quote (car m))
  53.                (appq (cdr m))))))
  54.  
  55. (defun sdfdsfs(eval e a)
  56.     (cond
  57.       ((atom e) (assoc e a))
  58.       ((atom (car e))
  59.        (cond
  60.          ((eq (car e) 'quote)
  61. ;
  62. ;;end of program
  63. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement