diff --git a/src/predicates.clj b/src/predicates.clj index abb431d..37400c2 100644 --- a/src/predicates.clj +++ b/src/predicates.clj @@ -9,27 +9,27 @@ {:name "Solanin"} {:name "Monster 3" :series "Monster"}]) -(def china {:name "China Miéville", :birth-year 1972}) -(def octavia {:name "Octavia E. Butler" - :birth-year 1947 - :death-year 2006}) -(def kay {:name "Guy Gavriel Kay" :birth-year 1954}) -(def dick {:name "Philip K. Dick", :birth-year 1928, :death-year 1982}) -(def zelazny {:name "Roger Zelazny", :birth-year 1937, :death-year 1995}) - -(def authors #{china, octavia, kay, dick, zelazny}) - -(def cities {:title "The City and the City" :authors #{china} - :awards #{:locus, :world-fantasy, :hugo}}) -(def wild-seed {:title "Wild Seed", :authors #{octavia}}) -(def lord-of-light {:title "Lord of Light", :authors #{zelazny} - :awards #{:hugo}}) -(def deus-irae {:title "Deus Irae", :authors #{dick, zelazny}}) -(def ysabel {:title "Ysabel", :authors #{kay}, :awards #{:world-fantasy}}) -(def scanner-darkly {:title "A Scanner Darkly" :authors #{dick}}) - -(def books #{cities, wild-seed, lord-of-light, - deus-irae, ysabel, scanner-darkly}) +;(def china {:name "China Miéville", :birth-year 1972}) +;(def octavia {:name "Octavia E. Butler" +; :birth-year 1947 +; :death-year 2006}) +;(def kay {:name "Guy Gavriel Kay" :birth-year 1954}) +;(def dick {:name "Philip K. Dick", :birth-year 1928, :death-year 1982}) +;(def zelazny {:name "Roger Zelazny", :birth-year 1937, :death-year 1995}) +; +;(def authors #{china, octavia, kay, dick, zelazny}) +; +;(def cities {:title "The City and the City" :authors #{china} +; :awards #{:locus, :world-fantasy, :hugo}}) +;(def wild-seed {:title "Wild Seed", :authors #{octavia}}) +;(def lord-of-light {:title "Lord of Light", :authors #{zelazny} +; :awards #{:hugo}}) +;(def deus-irae {:title "Deus Irae", :authors #{dick, zelazny}}) +;(def ysabel {:title "Ysabel", :authors #{kay}, :awards #{:world-fantasy}}) +;(def scanner-darkly {:title "A Scanner Darkly" :authors #{dick}}) +; +;(def books #{cities, wild-seed, lord-of-light, +; deus-irae, ysabel, scanner-darkly}) (defn sum-f [f g x] (+ (f x) (g x))) @@ -38,7 +38,7 @@ (fn[k] (< k n))) (defn equal-to [n] - (fn[k] (= k n))) + (fn[k] (== k n))) (defn set->predicate [a-set] (fn[a-map] (contains? a-set a-map))) @@ -67,7 +67,7 @@ (if (some pred a-seq) (some pred a-seq) false)) (defn my-every? [pred a-seq] - (pred a-seq)) + (not (some (complement pred) a-seq))) (defn prime? [n] (let [pred (fn[div] (= (mod n div) 0))]