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 all the worker threads die, the application could appear to be “up” but cease to do any useful work. And you’ll never know why.
Some more Clojure Do’s and Don’ts for you. This week: record constructors.
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
.
My unscientific, incomplete, thoroughly biased view of interesting things that happened with Clojure in 2014.
I heard the Shellshock vulnerability didn’t have a cool logo like Heartbleed. So I decided to draw one:
Copyright © 2014 Stuart Sierra
This work is licensed under a Creative Commons Attribution 4.0 International License.
This is my third Clojure year-in-review post. In 2011 I was excited about Clojure 1.3, ClojureScript, and the second Clojure/conj. By 2012 I was blown away by four Clojure conferences, two O’Reilly books, reducers, Datomic, Immutant, and a partridge in a pear tree.
For 2013, where do I even start? So much has happened this year I can’t even begin to keep track of it all. What follows is my incomplete, highly-biased summary of the significant news for Clojure in 2013.
Maybe I should start right here at my home base, Relevance, which, after years of close collaboration, finally tied the knot with Rich Hickey and Datomic to become Cognitect.
This merger opens up new possibilites with the introduction of enterprise-grade 24/7 support for Clojure, ClojureScript, Datomic, and the rest of the Clojure “stack.” Plenty of big businesses have been waiting for just this kind of safety guarantee before they jump into the Clojure open-source ecosystem, so this means we should be seeing Clojure in more, and bigger, places in 2014. Hear more on the transition episode of the Relevance Podcast, renamed the Cognicast.
In other industry / mindshare news:
Staples acquired Runa, an early adopter of Clojure, where they will continue to leverage Clojure for customized offers and other retail services.
The Clojure mailing list has over 8500 members.
In Chas Emerick’s 2013 State of Clojure survey, over half of respondents said they were using Clojure at work, a jump from last year. Alex Miller dug through the free-form responses to identify trends in desired features and perceived problem areas.
A batch of new Clojure books came out, notably the first O’Reilly Clojure Cookbook, written collaboratively by the community and edited by my colleagues Luke VanderHart and Ryan Neufeld.
Those looking to learn Clojure also got some new free resources: Clojure for the Brave and True by Daniel Higginbotham and Clojure from the Ground Up by Kyle Kingsbury.
More conferences: Clojure/West and Clojure/conj and the second EuroClojure. Not to mention Clojure being a big part of the functional programming discussion at YOW! Lambda Jam in Australia, Lambda Jam in Chicago, and the venerable Strange Loop. You can catch videos on ClojureTV on YouTube, InfoQ Clojure presentations, and other channels.
Inspired by efforts to teach programming to beginners, some friends founded ClojureBridge. A first workshop is scheduled for spring of 2014, and volunteers are developing curriculum and documentation.
Two programming contests, Clojure Cup and Lisp in Summer Projects, showed off programming talent from around the world
Clojure 1.5 was released, bringing reducers, improved reader literals, new form-threading macros, and the new EDN reader. See the Clojure change log for details.
Clojure 1.6 alphas emerged with a new public API for calling Clojure from Java.
The core.async library alphas burst onto the scene, further extending the great support for concurrency and asynchronous programming in Clojure and ClojureScript.
ClojureScript grew rapidly, adding source maps for debugging in a browser plus tons of performance enhancements. David Nolen’s blog showcases some of the possibilities of ClojureScript with core.async. There’s also a dedicated ClojureScript Google Group now.
Stuart Halloway announced the public release of data.fressian, the efficient binary encoding of Clojure data structures used by Datomic. See his data.fressian talk from Clojure/conj.
A successful fund-raising campaign helped Ambrose Bonnaire-Sergeant bring Typed Clojure from an academic thesis to production-ready code.
That same campaign plus additional funding from Cognitect helped Nicola Mometto release new libraries based on his experimental Clojure-in-Clojure port: tools.analyzer, tools.analyzer.jvm, tools.emitter.jvm, and tools.reader.
Contributors closed 562 tickets on the Clojure.org JIRA (not counting duplicates or declined tickets) including 68 on the core language.
The contrib libraries tools.cli, java.jdbc, and math.combinatorics got significant new releases.
The Datomic team released Simulant for simulation testing of large distributed systems. See Stuart Halloway’s Simulant presentation on InfoQ.
Relevance/Cognitect released Pedestal, a client-server web toolkit to showcase the possibilities of Clojure on the server and ClojureScript in the browser.
nrepl.el became CIDER, the Clojure IDE and REPL for Emacs.
Chas Emerick’s Austin made ClojureScript REPLs easier to use.
New IDEs dedicated to Clojure appeared: Nightcode and Cursive for IntelliJ.
Prismatic released their Plumbing / Graph library as well as Schema for run-time type validation.
Immutant, a Clojure application server based on JBoss, made its 1.0 release.
Mark Engleberg released Instaparse, a parser generator that understands standard EBNF/ABNF notation.
I blogged about My Clojure Workflow, Reloaded, spawning dozens of experimental frameworks for doing dependency injection and modular programming in Clojure, including my own Component.
Tons more interesting stuff happened in 2013. I couldn’t even begin to capture it all in one place. Here are some other good places to look for interesting Clojure news:
Relevance Podcast, renamed the Cognicast
Mostly Lazy podcast
Planet Clojure blog aggregator
Here’s to a great 2014!