Collection: Clojure Foundations

In this series, core aspects of Clojure are taken apart and put together again, to see what exactly makes them tick. Seq, records, protocol, core functions and essential libraries. Level up now!

38. Transducers
Published 19 January 18

Transducers are a Clojure feature allowing you to write code that is efficient, reusable, and composable. They have been around for several years, landing first in Clojure 1.8, but even some experienced Clojure programmers are not yet reaping the benefits of their use. In this episode we’ll look at the problems that Transducers solve, and how you use them in practice.

26. Component and System
Published 07 March 17

Stuart Sierra’s Component is a small library that can have a big impact on the structure and architecture of your application. In this episode you learn how you can use it to create components, and manage dependencies. You will create a Jetty and an Endpoint component, and use the PostgreSQL component from the System project.

24. defrecord and defprotocol
Published 30 January 17

With records, Clojure has introduced a way to create struct-like objects, while avoiding some of the problems encountered in object orientation. Records don’t hide their data behind custom interfaces, but instead partake in the abstractions that Clojure’s own data types are built on, so that code can treat treat a record like a regular Clojure data type.

Protocols are Clojure’s take on abstract interfaces. They make it possible to extend preexisting types to new methods, and extend preexisting methods to new types, thus avoiding the expression problem.

23. deftype and definterface
Published 19 January 17

Clojure is built on a well thought out set of abstractions. To implement these, it makes use of the ability to define abstractions in the host language, namely Java interfaces, and the high-performance polymorphism that they provides.

As a Clojure programmer you don’t have to resort to Java to achieve the same thing. All the facilities are there to create interfaces, and to create types that implement interfaces, getting you as close to the JVM as you need to be.

22. Seq and SeqableFreebie
Published 23 December 16

Seqs are a key abstraction in how Clojure processes data, but what exactly is a “seq”, and how does it relate to “seqable?”. Time for a deep dive in Clojure and ClojureScript source code to discover the finer points. Learn exactly what seqs and seqables are, what they do, and how you can use them to your advantage.

12. Clojure Keyword Arguments
Published 26 July 16

Clojure’s variable argument functions combined with map destructuring results in a concise syntax for keyword arguments. We’ll pick this feature apart to see exactly what’s inside. You’ll learn about “mapply”, and learn why keyword arguments aren’t always the best solution.

7. Intro to clojure.specFreebie
Published 08 June 16

The spec library which will be included in Clojure 1.9 gives you a powerful mechanism for validating data. Find out how to use it in this episode.

1. clojure.core/someFreebie
Published 09 May 16

Clojure’s some function is surprisingly versatile. Find out what it does, and what you can do with it.