Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (print(apply '+ '(33 56))); (+ 33 56)
- (print (funcall 'cons '(a b) 'c)); (cons '(a b) 'c)
- (print(mapl 'cons '(apply funcall) '(3)))
- (print(funcall 'apply 'list '(a (a b))))
- (print (progn
- (setq b 6)
- (atom `(car(a ,b)))
- )
- )
- (print (funcall '+ '33 '56))
- (print (apply 'cons '((a b) c)))
- ;2
- (setq x '(1 2 3 (1 2 3 4 5) 5 6))
- (setq f '(+ member *))
- (defun aapply (f x)
- (cond
- ((null x) nil)
- (t(cons(apply (car f) (list (car x) (cadr x))) (aapply (cdr f) (cddr x))))
- )
- )
- (print (aapply f x))
- ;3
- (setq pr 'numberp)
- (setq ls '(4 2 f 2 8 h 3 j 0 9 s))
- (defun every_m3 (pr ls)
- (cond ((null ls) T)
- (t(and(funcall pr (car ls)) (every_m3 pr (cdddr ls))))
- )
- )
- (print (every_m3 pr ls))
- ;4
- (setq fn '-)
- (setq x '((1 2) (3 4 5)))
- (defun map-car (fn x)
- (cond ((null x) nil)
- ((atom (car x))(cons (funcall fn (car x)) (map-car fn (cdr x))))
- ((listp (car x))(cons (apply fn (car x)) (map-car fn (cdr x))))
- )
- )
- (print ( map-car fn x))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement