Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;1
- (defun summa (m n) (cond
- ((< n 0) 0)
- ((> m n) 0)
- ((evenp n) ( + n (summa m (- n 2))))
- (t (summa m (- n 1)))
- )
- )
- ;(print (summa 2 6))
- ;2
- (setq lst '(k b c))
- (defun counts (w)
- (cond ((null w) 0)
- ((numberp (car w)) (counts (cdr w)))
- ((listp (car w)) (+ (counts (car w)) (counts (cdr w))))
- ((symbolp (car w)) (+ 1 (counts (cdr w))))
- )
- )
- (print(counts lst))
- ;(print(symbolp (caddr lst)))
- (print(counts '(a (c 5 (d s s((s))) e)g)))
- ;3
- (defun f(n)
- (cond ((= n 0) 1)
- ((= n 1) 2)
- (t (-(* 2 (f (- n 1))) (f(- n 2))))
- ) )
- ;(print (f 4))
- ;4
- (defun create (a n)
- (cond ((= n 0) nil)
- (t(cons (cons a nil) (create a (- n 1))))
- )
- )
- ;(print(create 2 4))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement