May 2018
Beginner to intermediate
290 pages
6h 43m
English
Because Clojure—and Clojure programmers—do rely so heavily on functions, it’s not surprising that the language provides some extras to help you craft just the function that you want. For example, all the functions we’ve written so far have taken a fixed number of arguments. Sometimes it’s convenient to build functions that take a less doctrinaire view of how many arguments they are willing to accept. For example, we might want to create a Hello, World–style function that will let you supply a greeting or default to a plain old “Hello”. This is not hard:
| | (defn greet |
| | ([to-whom] (println "Welcome to Blotts Books" to-whom)) |
| | ([message to-whom] (println message to-whom))) |
The greet function ...
Read now
Unlock full access