A pattern I particularly dislike: Function parameters which may or may not be collections.
Tag: do’s and don’ts
Clojure Don’ts: Optional Arguments with Varargs
Another Clojure don’t today. This one is a personal style preference, but I’ll try to back it up. Say you want to define a function with a mix of required and optional arguments. I’ve often seen this:
Clojure Do’s: Uncaught Exceptions
Some more do’s and don’ts for you. This time it’s a ‘do.’ In the JVM, when an exception is thrown on a thread other than the main thread, and nothing is there to catch it, nothing happens. The thread dies silently. This is bad news if you needed that thread to do some work. If… Continue reading Clojure Do’s: Uncaught Exceptions
Record Constructors
Some more Clojure Do’s and Don’ts for you. This week: record constructors. Don’t use interop syntax to construct records
Clojure Do’s: Namespace Aliases
Third in a series, this time with some style recommendations based on my personal experience.
Clojure Don’ts: isa?
Dynamic typing is cool, but sometimes you just want to know the type of something.
Clojure Don’ts: Concat
Welcome to what I hope will be an ongoing series of Clojure do’s and don’ts. I want to demonstrate not just good patterns to use, but also anti-patterns to avoid. Some of these will be personal preferences, others will be warnings from hard-won experience. I’ll try to indicate which is which. First up: concat.