Wrapping Up
In this chapter we took a look at how flexible a Clojure function can be. We’ve seen how you can define functions that take a variable number of arguments and at how you can hang a bit of documentation on your function. We also looked at multimethods, which enable you to define functions that execute different code depending on the arguments they are passed. We’ve seen how to write functions that take advantage of tail recursion and we’ve had a tour of pre and post conditions, which enable you to validate the data entering and leaving your functions.
Now that we’ve taken a good look at what a Clojure function is capable of, it’s time to address a bigger question: Why are functions so central to Clojure programming that we call Clojure ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access