daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Dec 6th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (define (a-op-b? op expr)
  2.   (and (list? expr)
  3.        (= (length expr) 3)
  4.        (symbol? (car expr))
  5.        (eq? op (car expr))
  6.        (or (number? (cadr expr))
  7.            (symbol? (cadr expr))
  8.            (list? (cadr expr)))
  9.        (or (number? (caddr expr))
  10.            (symbol? (caddr expr))
  11.            (list? (caddr expr)))))
  12.  
  13. (define (a*b? expr)
  14.   (a-op-b? '* expr))
  15.  
  16. ((a*b? expr)
  17.          (let ((a (cadr expr))
  18.                (b (caddr expr)))
  19.            (list '+
  20.                  (list '* (derivative a) b)
  21.                  (list '* a (derivative b)))))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top