diff --git a/ch01-welcome-repl-interactions.clj b/ch01-welcome-repl-interactions.clj index 9e3ed8d..c5477b5 100644 --- a/ch01-welcome-repl-interactions.clj +++ b/ch01-welcome-repl-interactions.clj @@ -1,4 +1,3 @@ - ;----- (defn average [numbers] @@ -542,10 +541,12 @@ p ;----- (letfn [(odd? [n] - (even? (dec n))) + (if (zero? n) + false + (even? (dec n)))) (even? [n] (or (zero? n) - (odd? (dec n))))] + (odd? (dec n))))] (odd? 11)) ;= true diff --git a/ch03-collections-repl-interactions.clj b/ch03-collections-repl-interactions.clj index 4d80d79..810f7e8 100644 --- a/ch03-collections-repl-interactions.clj +++ b/ch03-collections-repl-interactions.clj @@ -575,7 +575,7 @@ sm ;----- (defn compare-magnitude [a b] - (- (magnitude a) (magnitude b))) + (neg? (- (magnitude a) (magnitude b)))) ((comparator compare-magnitude) 10 10000) ;= -1 diff --git a/ch06-datatypes-repl-interactions.clj b/ch06-datatypes-repl-interactions.clj index 2b55d9a..1d327ed 100644 --- a/ch06-datatypes-repl-interactions.clj +++ b/ch06-datatypes-repl-interactions.clj @@ -551,7 +551,7 @@ Point [[(:x pt)] [(:y pt)]]) :cols (fn [pt] [[(:x pt) (:y pt)]]) - :dims (fn [pt] [2 1])) + :dims (fn [pt] [2 1])}) ;----- diff --git a/ch12-patterns-repl-interactions.clj b/ch12-patterns-repl-interactions.clj index 3c19387..41ef5fb 100644 --- a/ch12-patterns-repl-interactions.clj +++ b/ch12-patterns-repl-interactions.clj @@ -80,7 +80,7 @@ class MyApp { (defprotocol Bark (bark [this])) -(defrecord Chihuahua [weight price] +(defrecord Chihuahua [] Bark (bark [this] "Yip!")) diff --git a/ch14-rdbms-repl-interactions.clj b/ch14-rdbms-repl-interactions.clj index 97f03ae..0e6cb61 100644 --- a/ch14-rdbms-repl-interactions.clj +++ b/ch14-rdbms-repl-interactions.clj @@ -1,4 +1,3 @@ - ;----- (require '[clojure.java.jdbc :as jdbc]) ;= nil @@ -12,13 +11,13 @@ {:classname "com.mysql.jdbc.Driver" :subprotocol "mysql" :subname "//localhost:3306/databasename" - :username "login" + :user "login" :password "password"} ;----- {:datasource datasource-instance - :username "login" + :user "login" :password "password"}