learning-sicp

My embarrassing half assed SICP run.
git clone https://kaka.farm/~git/learning-sicp
Log | Files | Refs

exercise-56.scm (1035B)


      1 (define-library (sicp tests chapter-2 exercise-56)
      2   (import (scheme base)
      3           (srfi :64)
      4           (sicp solutions chapter-2 exercise-56))
      5 
      6   (begin
      7     (test-begin "deriv-stuff")
      8     ;; Original:
      9     ;; (test-equal
     10     ;;     '(+ 1 0)
     11     ;;   (deriv '(+ x 3) 'x))
     12     ;; (test-equal
     13     ;;     '(+ (* x 0) (* 1 y))
     14     ;;   (deriv '(* x y) 'x))
     15     ;; (test-equal
     16     ;;     '(+ (* (* x
     17     ;;               y)
     18     ;;            (+ 1
     19     ;;               0))
     20     ;;         (* (+ (* x 0)
     21     ;;               (* 1 y))
     22     ;;            (+ x 3)))
     23     ;;   (deriv '(* (* x y) (+ x 3)) 'x))
     24 
     25     ;; Simplificating:
     26 
     27     (test-equal
     28         1
     29       (deriv '(+ x 3) 'x))
     30     (test-equal
     31         'y
     32       (deriv '(* x y) 'x))
     33     (test-equal
     34         '(+ (* x y)
     35             (* y
     36                (+ x 3)))
     37       (deriv '(* (* x y) (+ x 3)) 'x))
     38     (test-equal
     39         '(* 3 (** x 2))
     40       (deriv '(** x 3) 'x))
     41     (test-equal
     42         '(* -1 (** x -2)) ;; hell oh hell...
     43       (deriv '(** x -1) 'x))
     44     (test-end "deriv-stuff")))