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

termine le tp #1620

Open
wants to merge 4 commits 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
/target
/lib
/classes
Expand All @@ -8,3 +9,5 @@ pom.xml
.lein-deps-sum
.lein-failures
.lein-plugins
/i-am-a-horse-in-the-land-of-booleans.iml
/.lein-repl-history
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: clojure
lein: lein2
script: lein2 midje :config .midje-grading-config.clj
lein: lein
script: lein midje :config .midje-grading-config.clj
jdk:
- openjdk7
- openjdk11
notifications:
email: false
webhooks: http://polar-hollows-8825.herokuapp.com/notifications
5 changes: 3 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(defproject i-am-a-horse-in-the-land-of-booleans "1.0.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.5.1"]
:dependencies [[org.clojure/clojure "1.10.0"]
[iloveponies.tests/i-am-a-horse-in-the-land-of-booleans "0.1.0-SNAPSHOT"]]
:profiles {:dev {:plugins [[lein-midje "3.1.1"]]}})
:profiles {:dev {:dependencies [[midje "1.9.5" :exclusions [org.clojure/clojure]]]
:plugins [[lein-midje "3.2.1"]]}})
29 changes: 21 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,40 @@
(:refer-clojure :exclude [boolean]))

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

(defn abs [x]
":(")
(if (neg? x) (* x -1) x))

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

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


(defn teen? [age]
":(")
(if (and (>= age 13) (<= age 19)) true false))

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

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

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

; '_______'