Clojure: "cond" not implemented?


#1

I’m on the “Molotov Medic” level and I’m getting this error:

Missing `this.` keyword; should be `this.cond`.
There is no function `cond`, but `this` has a method `cond`.

For the following code on line 7:

 (defn maxHealth? [friend]
  (= (.maxHealth friend)
      (.health friend)))

(defn getFriendWithLeastHealth []
  (let [friends (filter #(not (maxHealth? %1)) (.getFriends this))]
    (cond 
      (= 1 (count friends)) (first friends)
      (< 1 (count friends)) (reduce #(if (<= (.health %1) (.health %2)) %1 %2) friends))))

(defn heal [friend]
  (.attack this friend)
  (.say (str "Healing " friend)))

(defn attackNearestEnemy []
  (let [enemy (.getNearestEnemy this)]
    (if (some? enemy)
      (do (.attack this enemy)
          (.say this (str "Attacking " enemy))))))

(let [friend (getFriendWithLeastHealth)]
  (if (and (some? friend) (maxHealth? friend))
    (heal friend)
      (attackNearestEnemy)))

Is “cond” not implemented? This is my first time using Clojure, so it could very well be my code.


#2

Hmm, not sure–the Closer.js parser that Vicky Chijwani built for CodeCombat doesn’t say one way or the other if it’s in there: https://github.com/vickychijwani/closer.js

Would you mind opening an issue over there so he’ll see this? I don’t think he reads this forum yet.