]> git.rkrishnan.org Git - sicp.git/blob - src/sicp/ex1_4.clj
Merge branch 'master' of github.com:vu3rdd/sicp
[sicp.git] / src / sicp / ex1_4.clj
1 (ns sicp.ex1_4
2   (:use [sicp utils]
3         [clojure.contrib trace test-is]))
4
5 ;; exercise 1.4: Observe that our model of evaluation allows for
6 ;;               combinations whose operators are compound
7 ;;               expressions. Use this observation to describe the
8 ;;               behavior of the following procedure:
9 ;; (defn a-plus-abs-b [a b]
10 ;;   ((if (> b 0) + -) a b))
11 (comment
12   If b is positive, we do (+ a b) and if it is negative, we do (- a b).
13   This makes use of the fact that the first element in a list is an
14   operand. Here, the operand is chosen based on other operators.
15   )