README updated
This commit is contained in:
parent
3d6d81c63a
commit
abea3219fb
2 changed files with 9 additions and 7 deletions
|
|
@ -68,7 +68,9 @@ The output is telling you that you have a failing test in the file named
|
|||
`01_equalities.clj`, on line 3. So you just need to open that file up and make
|
||||
it pass! You'll always be filling in the blanks to make tests pass.
|
||||
Sometimes there could be several correct answers (or even an infinite number):
|
||||
any of them will work in these cases.
|
||||
any of them will work in these cases. Some tests will pass even if you replace the
|
||||
blanks with whitespace or nothing instead of the expected answer. Make sure you
|
||||
give one correct expression to replace each blank.
|
||||
|
||||
The koans differ from normal TDD in that the tests are already written for you,
|
||||
so you'll have to pay close attention to the failure messages, because up until
|
||||
|
|
|
|||
|
|
@ -7,19 +7,19 @@
|
|||
"!")))
|
||||
|
||||
(defmulti diet (fn [x] (:eater x)))
|
||||
(defmethod diet :herbivore [a] __)
|
||||
(defmethod diet :carnivore [a] __)
|
||||
(defmethod diet :default [a] __)
|
||||
(defmethod diet :herbivore [a] (str (:name a) " eats veggies."))
|
||||
(defmethod diet :carnivore [a] (str (a :name) " eats animals."))
|
||||
(defmethod diet :default [a] (str "I don't know what " (:name a) " eats."))
|
||||
|
||||
(meditations
|
||||
"Some functions can be used in different ways - with no arguments"
|
||||
(= __ (hello))
|
||||
(= "Hello World!" (hello))
|
||||
|
||||
"With one argument"
|
||||
(= __ (hello "world"))
|
||||
(= "Hello, you silly world." (hello "world"))
|
||||
|
||||
"Or with many arguments"
|
||||
(= __
|
||||
(= "Hello to this group: Peter, Paul, Mary!"
|
||||
(hello "Peter" "Paul" "Mary"))
|
||||
|
||||
"Multimethods allow more complex dispatching"
|
||||
|
|
|
|||
Loading…
Reference in a new issue