The cond macro works like the way the if conditional
does branching. Unlike if, cond can take multiple tests and corresponding clauses.
Since Clojure doesn’t have else if, cond is used for that purpose.
The example below needs three tests.
if a temperature is over 65F, I’ll enjoy walking at a park.
if a temperature is lower than 65F and higher than 45F, I’ll spend time at a cafe.
if a temperature is below 45F, I’ll crawl in my bed.
In this case, we can’t use if, but we can do this with cond.
The syntax is: (cond & clauses)
Clojure has condp macro also.
The usage is similar to cond, but it takes a part of test right after the condp.