Wrapping Up

In this chapter you’ve seen how Clojure’s support for functional programming strikes a well-motivated balance between academic purity and effectiveness on the Java Virtual Machine. Clojure provides a wide variety of techniques including self-recursion with recur, mutual recursion with trampoline, lazy sequences, and memoization.

Better still, for a wide variety of everyday programming tasks, you can use the sequence library without ever having to define your own explicit recursions of lazy sequences. Functions like partition create clean, expressive solutions that are much easier to write.

Finally, we saw how Clojure provides eager approaches as a companion to lazy sequences for use cases where eager evaluation is better suited. Transducers provide fast, composable transformations that can be used in a variety of situations to produce output collections, improve performance, and manage external resources.

At this point, you’ve seen the core of Clojure—the syntax, immutable collections, the sequence abstraction, functional programming, and recursion. With the next chapter, we’ll begin adding additional features. These features all build on top of the core ideas of immutable data and functional transformation. We’ll start with spec, a Clojure library for describing the structure of data and functions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.21.175