Day 2: Yoda and the Force
As a Jedi master, Yoda trained apprentices to use and understand the Force, the unifying presence between all living things. In this section, we get to the concepts fundamental to Clojure. We’ll talk about sequences, the abstraction layer that unifies all Clojure collections and ties them to Java collections. We’ll also look at lazy evaluation, the just-in-time strategy that computes sequence members only when you need them. And then we’ll look at that mystical language feature that is the Force for all Lisps, the macro.
Recursion with loop and recur
As you’ve learned in other languages in this book, functional languages depend on recursion rather than iteration. Here’s a recursive program to evaluate the size of a ...