Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro define-valid-functions (function=arity-pairs) ;Takes dotted lists because why not.
- (loop
- for i in function=arity-pairs
- if (numberp (cdr i))
- do `(define-valid-function ,(car i) ,(cdr i))
- else `(define-valid-function ,(car i))))
- (define-valid-functions '((+) (-) (*) (/)
- (sin . 1) (cos . 1) (tan . 1)
- (sqrt . 1) (random . 0) (pow . 2)))
- (defun eval-maths (form)
- (when (math-expr-p form) form))
Advertisement
Add Comment
Please, Sign In to add comment