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

tests pass #1614

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
43 changes: 33 additions & 10 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,50 @@
(:refer-clojure :exclude [boolean]))

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

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

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

(defn fizzbuzz [n]
":(")
(cond
(== (mod n 15) 0) "gotcha!"
(== (mod n 3) 0) "fizz"
(== (mod n 5) 0) "buzz"
:else ""))

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

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

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

(defn leap-year? [year]
":(")

; '_______'
(if (< year 100)
(if ( == (mod year 4) 0)
true
false)
(if ( == (mod year 100) 0)
(if ( == (mod year 400) 0)
true
false))))


; '_______'