(print 1)
(defun S (x)
(if (EQUAL (CDR x) '())
(CAR x)
(S (cdr x))
)
)
(print (S '(1 2 3 4 6 7 8)))
(print 2)
(defun R (a n x)
(cond
( (= n 1) (cons a x) )
( (= n 0) (cons a (R a (- n 1) (cdr x) )) )
( T (cons (car x) (R a (- n 1) (cdr x))))
)
)
(print (R 8 2 '(7 2 3 4)))
(print 3)
(defun S ( n x)
(cond
( (EQUAL x NIL) Nil )
( (= (CAR x) n) T )
( T (S n (cdr x)))
)
)
(print (S 7 '()))
(print (S 70 '(1 2 3 4 6 7 8)))
(print (S 7 '(1 2 3 4 6 7 8)))
(print 4)
(defun Del (x s)
(COND
((EQUAL s NIL) NIL)
((EQUAL x (car s)) (Del x (cdr s)))
(T (CONS (car s) (Del x (cdr s))))
)
)
(print (Del 'a '(a n a x)))
(print 5)
(defun Neg (x)
(cond
((EQUAL x NIL) 0)
((+ (if (< (car x) 0) 1 0) (Neg (cdr x))))
(T (Neg (cdr x)))
)
)
(print (Neg '(-1 4 9 -8 3)))
(print 6)
( defun Max(x)
(cond
((EQUAL x NIL) NIL)
((EQUAL (CDR x) NIL) (car x))
((> (car x) (cadr x)) (Max (cons (car x) (cddr x))))
( T (Max (cdr x) ))
)
)
(print (Max '(-1 4 9 -8 3)))
(print 7)
( defun Vloj(n)
(cond
( (= n 0) 'A)
( (= n 1) (cons 'A '()))
( T (cons (Vloj (- n 1)) '()))
)
)
(print (Vloj 0 ))
(print (Vloj 1 ))
(print (Vloj 4 ))
(print 8)
(defun Pow (n)
(cond
((= n 0) '())
((= n 1) '(A))
( T (cons 'A (Pow (- n 1) ) ) )
)
)
(print (Pow 0 ))
(print (Pow 1 ))
(print (Pow 8 ))
(print 10)
(defun P ( x)
(cond
((EQUAL x NIL) NIL)
((EQUAL (cddr x) NIL) (list (cadr x) (car x) ) )
( T (cons (cadr x) (cons (car x) (P(cddr x)) ) ) )
)
)
(print (P '(1 2 3 4 5 6 ) ))
(print 12)
(defun Obed (x y)
(cond
( (null x) y)
( (null y) x)
(T (cons (car x) (cons (car y) (Obed (cdr x) (cdr y)))) )
)
)
(print (Obed '() '(A B C)))
(print (Obed '(1 2 3) '()))
(print (Obed '(1 2 3) '(A B C)))