Clojure Weekly, April 29th, 2014
Welcome to another issue of Clojure Weekly, my small routine blog contribution to the Clojure sphere! These are just a few links, normally 4/5 urls, pointing at articles, documentation, screencasts, podcasts or anything else that attracts my attention. I add a small comment so you can decide if you want to look at the whole thing or not. That’s it, enjoy!
Euroclojure Programme The program for Euroclojure is finalized. Many interesting talks including yours truly speaking just before Rich (argh). Also from Cognitect we're going to have Stuart Sierra and David Nolen. There is also an impressive number of Londoneers presenting. See you there.
tree-seq - Clojure v1.6 API documentation Tree-seq is a generic depth-first walk function for tree-like structures that returns a lazy sequence of all the nodes in a tree. It takes two fns and a start-root. The two fns are all that is needed to walk any kind of tree. branch? is a function that takes a node and return false when this is a leaf. children is a function that given a node is expecting the list of other nodes down that path. An already implemented use in the std lib is file-seq, which is returning a list of all the nodes when iterating java.io.File types.
Lisp Flavored Erlang LFE (not to be confused with left fold enumerators) is a lisp implemented on top of the Erlang VM. It is not strictly related to Clojure except that I believe they share some of the difficulties in parsing and adapting a Lisp to run on a VM specifically designed for another language (Java or Erlang in this case). LFE is closer to Common Lisp than Clojure (which deliberately is trying to improve Lisp and drastically enhancing its syntax). Trivia: LFE is a lisp-2 (Clojure is a lisp-1). I don't think LFE achieved the same popularity that Clojure did and my guess is that who wanted to leverage the Erlang VM did that in Erlang directly (that despite the syntax oddities is still a great functional language).
Clojure - Statistics Overview If you ever wonder how much interest Clojure is generating around, here are the clojure.org web stats. This is not definitive answer, it just gives an idea about popularity based on page views and a break down by country, not much more. The average uniques are steadily increasing, now about 3500-5000 per day. There was a huge spike 6th January 2013, wondering what that was.
tonsky/datascript Interesting ClojureScript idea, implementing a Datalog query engine on top of Clojure immutable data structures. It is meant to run in the browser with a lifecycle starting at page load and ending the next page load. It is technically an in-memory database in the browser. When to use? When some widgetry on the page requires some more structured data (thinking about complex questionaries, single page apps processing data and so on). If "searching" through those data requires some constant array loop it could be a nice idea to put datalog on top instead.
Lisp50 Lisp50 was a once in a lifetime event for many (but I should be able to attend Lisp100!) It was a co-conference with OOPSLA 2008 collecting for the first time in many years all the brilliant minds in the Lisp community, including McCarthy (by phone), Guy Steele and many more. This series of 5 article is a write-up of what happened there and is full of wisdom. Rich Hickey was last talking there. We should not forget that Clojure main goal was not just to imitate but to be a better Lisp, an attempt that has been made so many times without success. Previous presenters before Rich created a sort pessimistic atmosphere, looking at Lisp big ideas in the distant past without an opportunity of redemption for the present. You can imagine what happened when Rich introduced Clojure to that mix of bearded Lisp hackers and a few younger nostalgic fellows! Clojure is really the only re-incarnation of Lisp nowadays that is getting traction. Kudos to Rich for solving decades of Lisp problems with simple and pragmatic choices.
jfli / Mailing Lists Another bit of Clojure history. Clojure was announced to the public on October 17th 2007, after a couple of years of stealth development, on the jfli mailing list (another RH's project). The google groups was created at that time and about one year later in 2008 was already counting 700+ users and Rich was already invited at several important conferences (notably, Lisp50 celebrating 50 years of Lisp). Also about one year later the release 1.0 was very close, with AOT compilation as its main big new feature.
clojure - Put an element to the tail of a collection - Stack Overflow Why there is no such a function in Clojure that always append at the end? The official answer seems to be that you need to know your stuff. For example the implications of modifying a sequence implemented as a list or as a vector. Lately, I started to rely less on vectors and more on lazy seqs. What I like about sequences in general is that they are and stay lazy if you pay attention not to realize them, a nice feature that allows a lot of processing in code before actually processing the sequence for real. But what to use (vector VS seq) it all depends: is the collection going to be accessed sequentially or not? Is it going to be sorted often? And so on.
What does the leading arrow in a name mean in clojure - Stack Overflow Ah, got it. I was wondering from where that arrow was coming from, considering a defrecord could always be created with a post-fixed dot as for Java interop (since what is created is actually a Java class). So the defrecord macro is responsible for creating a function ->name-of-the-record that invokes the constructor of the record. The macro spits out a lot of other magic that is not easy to read, including hashCode and equals implementations and map like behaviour.