On Jul 6, 7:33 pm, Benny Tsai <benny.t...@gmail.com> wrote:
> Could you please post the entire form, including the code surrounding the
> cond form (since total, amount, and country need to be defined somewhere)?

Benny, that was just sample code to zero in on the initial issue.  I'm
working
through the SICP with a lot of pain but here's what I have so far:

(def us-coins (list 50 25 10 5 1))
(def uk-coins (list 100 50 20 10 5 2 1 0.5))

(defn first-denomination [ coin-values ] (first coin-values))

(defn except-first-denomination [ coin-values ] (rest coin-values))

(defn no-more? [coin-values] (nil? coin-values))

(defn cc [amount coin-values]
        (cond
                (= amount 0) 1
                (or (< amount 0) (no-more? coin-values)) 0
               :else (+ (cc amount (except-first-denomination coin-values))
                            (cc (- amount (first-denomination coin-
values)) coin-values))))


-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to