Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun operation-p (x)
- (or (equal x '+) (equal x '-) (equal x '*) (equal x '/)))
- (defun clone (sexpr)
- (cond
- ((listp sexpr)
- (if (null sexpr)
- ()
- (let ((hd (car sexpr))
- (tl (cdr sexpr)))
- (cond
- ((listp hd) (append (list (clone hd)) (clone tl)))
- ((operation-p hd) (list 'the 'fixnum (cons hd (clone tl))))
- (t (cons hd (clone tl)))))))
- (t sexpr)))
- (defmacro fast (&rest sexpr)
- `,(car (clone sexpr)))
- (defun main ()
- (progn
- (format t "~A~%" (+ 1 2 (* 3 4) (+ 5 (- 8 6))))
- (format t "~A~%" (fast (+ 1 2 (* 3 4) (+ 5 (- 8 6)))))))
- (main)
- (quit)
Advertisement
Add Comment
Please, Sign In to add comment