From b89d4a69ddfc81935d9d88f5608e88b7e54fe182 Mon Sep 17 00:00:00 2001 From: Oliver Vartiainen Date: Tue, 12 Sep 2017 21:42:10 +0300 Subject: [PATCH 1/2] Fix --- src/predicates.clj | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/predicates.clj b/src/predicates.clj index 158b1ea..b66374f 100644 --- a/src/predicates.clj +++ b/src/predicates.clj @@ -1,41 +1,45 @@ (ns predicates) (defn sum-f [f g x] - :-) + (+ (f x) (g x))) (defn less-than [n] - :-) + (fn [x] (< x n))) (defn equal-to [n] - :-) + (fn [x] (== x n))) (defn set->predicate [a-set] - :-) + (fn [x] (contains? a-set x))) (defn pred-and [pred1 pred2] - :-) + (fn [x] (and (pred1 x) (pred2 x)))) (defn pred-or [pred1 pred2] - :-) + (fn [x] (or (pred1 x) (pred2 x)))) (defn whitespace? [character] (Character/isWhitespace character)) (defn blank? [string] - :-) + (every? whitespace? string)) (defn has-award? [book award] - :-) + (contains? (:awards book) award)) (defn HAS-ALL-THE-AWARDS? [book awards] - :-) + (let [book-has-award? (fn [award] (has-award? book award))] + (every? book-has-award? awards))) (defn my-some [pred a-seq] - :-) + (first (filter identity (map pred a-seq)))) (defn my-every? [pred a-seq] - :-) + (= + (count a-seq) + (count (filter true? (map pred a-seq))))) (defn prime? [n] - :-) + (let [n-divides? (fn [divisor] (zero? (mod n divisor)))] + (nil? (some n-divides? (range 2 n))))) ;^^ From ff2c566aa9553d23f9a9d043099398e61e03b0c7 Mon Sep 17 00:00:00 2001 From: Oliver Vartiainen Date: Wed, 4 Oct 2017 21:48:44 +0300 Subject: [PATCH 2/2] Fix Travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 455f3c0..45c29f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: clojure -lein: lein2 -script: lein2 midje :config .midje-grading-config.clj +lein: lein +script: lein midje :config .midje-grading-config.clj jdk: - openjdk7 notifications: