Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;zad 1
- (defun element (el l)
- (if (null l) NIL
- (if (atom (car l))
- (if (equal el (car l)) T )
- (element el (cdr l) )
- )
- )
- )
- (element '1 '(a 2 3))
- ;zad 2
- (defun zgolemi (l)
- (pomosna '() l)
- )
- (defun pomosna (noval l)
- (if (null l) noval
- (if (numberp (car l))
- (pomosna (append noval (list (+ (car l) 1))) (cdr l) )
- (pomosna noval (cdr l) )
- )
- )
- )
- (zgolemi '(1 2 3))
- ;zad 3
- (defun pomosna (el l n)
- (if (null l) 0
- (if (eq el (car l)) n
- (pomosna el (cdr l) (+ 1 n))
- )
- )
- )
- (defun rbr (el l)
- (pomosna el l 0)
- )
- (rbr '2 '(1 1 2) )
- ;zad 4
- (defun pomosna (el n)
- (if (= el n) T
- (if (= (mod el n) 0) NIL
- (pomosna el (+ 1 n))
- )
- )
- )
- (defun prost (el)
- (pomosna el 2)
- )
- (prost 10)
- ;zad 5
- (defun pomosna (el l noval)
- (if (null l) noval
- (pomosna el (cdr l) (append noval (list(append '(el) (car l)))))
- )
- )
- (defun dodadi (el l)
- (pomosna el l '())
- )
- (dodadi 'a '((1 2 3) (a b c)))
- ;zad 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement