From 246743eaa4c5ef071a53acbf0b078c006da029ce Mon Sep 17 00:00:00 2001 From: Henrikh Kantuni Date: Wed, 1 Apr 2020 15:44:11 +0400 Subject: [PATCH] Errata --- content/cftbat/do-things.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/cftbat/do-things.html b/content/cftbat/do-things.html index f027ae3b..7b1886f2 100644 --- a/content/cftbat/do-things.html +++ b/content/cftbat/do-things.html @@ -491,7 +491,7 @@

Calling Functions

(Note that map doesn’t return a vector, even though we supplied a vector as an argument. You’ll learn why in Chapter 4. For now, just trust that this is okay and expected.)

Clojure’s support for first-class functions allows you to build more power­ful abstractions than you can in languages without them. Those unfamiliar with this kind of programming think of functions as allowing you to generalize operations over data instances. For example, the + function abstracts addition over any specific numbers.

By contrast, Clojure (and all Lisps) allows you to create functions that generalize over processes. map allows you to generalize the process of transforming a collection by applying a function—any function—over any collection.

-

The last detail that you need know about function calls is that Clojure evaluates all function arguments recursively before passing them to the function. Here’s how Clojure would evaluate a function call whose arguments are also function calls:

+

The last detail that you need to know about function calls is that Clojure evaluates all function arguments recursively before passing them to the function. Here’s how Clojure would evaluate a function call whose arguments are also function calls:

(+ (inc 199) (/ 100 (- 7 2)))
 (+ 200 (/ 100 (- 7 2))) ; evaluated "(inc 199)"
 (+ 200 (/ 100 5)) ; evaluated (- 7 2)