From abea3219fb7cd865799a22e2fc403cb7c3ffe977 Mon Sep 17 00:00:00 2001 From: Manas Karekar Date: Sun, 3 Mar 2013 19:32:09 -0500 Subject: [PATCH] README updated --- README.md | 4 +++- src/koans/09_runtime_polymorphism.clj | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f3cd403..5c04336 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/koans/09_runtime_polymorphism.clj b/src/koans/09_runtime_polymorphism.clj index a8171ee..37816e7 100644 --- a/src/koans/09_runtime_polymorphism.clj +++ b/src/koans/09_runtime_polymorphism.clj @@ -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"