Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementation #1619

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
32 changes: 24 additions & 8 deletions src/i_am_a_horse_in_the_land_of_booleans.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,43 @@
(:refer-clojure :exclude [boolean]))

(defn boolean [x]
":(")
(if x true false))

(defn abs [x]
":(")
(if (< x 0) (- x) x))

(defn divides? [divisor n]
":(")
(= (mod n divisor) 0))

(defn fizzbuzz [n]
":(")
(cond
(divides? 15 n) "gotcha!"
(divides? 3 n) "fizz"
(divides? 5 n) "buzz"
:else ""
))

(defn teen? [age]
":(")
(<= 13 age 19))

(defn not-teen? [age]
":(")
(not (teen? age)))

(defn generic-doublificate [x]
":(")
(cond
(number? x) (+ x x)
(empty? x) nil
(list? x) (* 2 (count x))
(vector? x) (* 2 (count x))
:else true
))

(defn leap-year? [year]
":(")
(cond
(not (divides? 4 year)) false
(not (divides? 100 year)) true
(not (divides? 400 year)) false
:else true
))

; '_______'