I discovered this clojure problem today:
(condp contains? some-set "foo" "foo in thar" "bar" "bar in thar" "t'aint thar")
The idea is to return a string under the first match, where some-set contains a value. If none of the values ββare in the set, it returns the last value. The problem is that the contains? function contains? takes the collection first, then the key and condp needs the first key.
I βfixedβ it by writing a function:
(defn reverse-params [f] (fn [ab] (fba))
and substituting a challenge to him:
(condp (reverse-params contains?) some-set "foo" "foo in thar" "bar" "bar in thar" "t'aint thar")
Which works, but my question is: have I missed some better way to do this (possibly using some )? I could use cond , but I decided that it would save me some typing.
stand source share