Skip to content

Commit

Permalink
Add divisible function
Browse files Browse the repository at this point in the history
  • Loading branch information
PEZ committed Aug 22, 2021
1 parent 75b9770 commit f4266fd
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions drams/calva_getting_started/hello_repl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,22 @@
;; You can re-indent, and format, code at will, using
;; the `Tab` key. It will format the current enclosing
;; form. Try it at the numbered places in this piece
;; of code, starting at `1`:
;; of code, starting at `; 1`:

(comment ; 3
(defn- divisible
"Is `n` divisible by `d`?"
[n d]
(zero? (mod n d)
)

)

(defn fizz-buzz [n] ; 2
(cond ; 1
(divizable? n (* 5 3)) "FizzBuzz"
(divizable? n 5) "Buzz"
(divizable? n 3) "Fizz"
(divisible n (* 5 3)) "FizzBuzz"
(divisible n 5) "Buzz"
(divisible n 3) "Fizz"
:else n))
)

Expand Down

0 comments on commit f4266fd

Please sign in to comment.