August 2014
Intermediate to advanced
120 pages
2h 45m
English
Let’s say you’re a former Ruby developer, and you really miss the feature of Ruby that allows any method, class, or module definition to act as an implicit begin (Ruby’s version of try). In other words, you’d like to be able to write this code in Clojure:
| language_features/implicit_try_1.clj | |
| | (defn delete-file [path] |
| | (clojure.java.io/delete-file path) |
| | (catch java.io.IOException e false)) |
This code doesn’t work in Clojure, of course—you’ll get a compiler exception if you try to type that in at your REPL. You’d need to wrap a try expression around everything following the argument list to get it to work as you want. Take a moment and think about what it would take to have this code work. One option would be to file an ...
Read now
Unlock full access