From 6d677f3a4d7c3bc230f4bd93efac20536ecfa863 Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com>
Date: Sun, 28 Mar 2010 18:29:22 +0530
Subject: [PATCH] exercise 1.3 redone

---
 chapter1/ch1_1.clj | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/chapter1/ch1_1.clj b/chapter1/ch1_1.clj
index b96191b..783e139 100644
--- a/chapter1/ch1_1.clj
+++ b/chapter1/ch1_1.clj
@@ -56,6 +56,17 @@
 (defn sum-of-sq-of-two-largest [a b c]
   (apply sum-of-squares (take 2 (sort3 a b c))))
 
+;; well, I cheated above. Let me use only the constructs introduced
+;; so far in the book. (follows after the sicp meetup #2 on 28/mar/2010.
+(defn sum-of-square-of-two-largest [a b c]
+  (if (> a b)
+    (if (> b c)
+      (sum-of-squares a b) ; a > b > c
+      (sum-of-squares a c))
+    (if (> a c)
+      (sum-of-squares b a)
+      (sum-of-squares b c))))
+
 ;; exercise 1.4: Observe that our model of evaluation allows for
 ;;               combinations whose operators are compound
 ;;               expressions. Use this observation to describe the
-- 
2.45.2