I want to use the condp clause but I dont know how to catch any unmatched clause. How do I do that?
(defn subst[id value W-lang]
(let [[type expr][(first W-lang)(rest W-lang)]]
(condp = type
'num (first expr)
'add expr
***** expr)))
The documentation for condp says:
A single default expression can follow the clauses, and its value will be returned if no clause matches. If no default expression is provided and no clause matches, an IllegalArgumentException is thrown.
So:
(condp = type
'num (first expr)
'add expr
expr)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With