@@ -2166,7 +2166,7 @@ Expands to calls to `extend-type`."
21662166 If the result is truthy returns the second value of the clause.
21672167
21682168 If the number of arguments is odd and no clause matches, the last argument is returned.
2169- If the number of arguments is even and no clause matches, nil is returned ."
2169+ If the number of arguments is even and no clause matches, throws an exception ."
21702170 [pred- form expr & clauses]
21712171 (let [x (gensym ' expr), pred (gensym ' pred)]
21722172 `(let [~ x ~ expr, ~ pred ~ pred- form]
@@ -2175,18 +2175,18 @@ Expands to calls to `extend-type`."
21752175 (if (> (count clause) 1 )
21762176 `((~ pred ~ a ~ x) ~ b)
21772177 `(:else ~ a)))
2178- (partition 2 clauses))))))
2178+ (partition 2 clauses))
2179+ :else (throw " No matching clause!" )))))
21792180
21802181(defmacro case
21812182 " Takes an expression and a number of two-form clauses.
21822183 Checks for each clause if the first part is equal to the expression.
21832184 If yes, returns the value of the second part.
21842185
2185- The first part of each clause can also be a set . If that is the case, the clause
2186- matches when the result of the expression is in the set .
2186+ The first part of each clause can also be a set . If that is the case, the clause matches when the result of the expression is in the set .
21872187
21882188 If the number of arguments is odd and no clause matches, the last argument is returned.
2189- If the number of arguments is even and no clause matches, nil is returned ."
2189+ If the number of arguments is even and no clause matches, throws an exception ."
21902190 [expr & args]
21912191 `(condp # (if (set? %1) (%1 %2) (= %1 %2))
21922192 ~ expr ~ @args))
0 commit comments