A pattern I particularly dislike: Function parameters which may or may not be collections.
Digital Digressions by Stuart Sierra
From programming to everything else
A pattern I particularly dislike: Function parameters which may or may not be collections.
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:
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…
Some more Clojure Do’s and Don’ts for you. This week: record constructors. Don’t use interop syntax to construct records
Third in a series, this time with some style recommendations based on my personal experience.
Dynamic typing is cool, but sometimes you just want to know the type of something.
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.