Skip to content

Commit

Permalink
2.8.2015
Browse files Browse the repository at this point in the history
  • Loading branch information
jEnbuska committed Aug 2, 2015
1 parent de348a1 commit d63318c
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions src/predicates.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand All @@ -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)))
Expand Down Expand Up @@ -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))]
Expand Down

0 comments on commit d63318c

Please sign in to comment.