August 2014
Intermediate to advanced
120 pages
2h 45m
English
Most macros, like our pattern matching example in the previous section, have very specific sets of input that they accept, and will throw strange-looking errors when those input expectations aren’t satisfied. For instance, if we didn’t realize that snore.match only handled vectors as input, we might try to match against a keyword, which would give us this error:
| language_features/error_handling_1.clj | |
| | (match :foo |
| | :oh "hi" |
| | :foo "bar" |
| | :else "else") |
| | UnsupportedOperationException count not supported on this type: Keyword |
| | clojure.lang.RT.countFrom (RT.java:556) |
| | java.lang.UnsupportedOperationException: count not supported on this type: Keyword |
| | RT.java:556 clojure.lang.RT.countFrom |
| | RT.java:530 clojure.lang.RT.count ... |
Read now
Unlock full access