Using Functions

Web Development with Clojure, Third Edition — by Dmitri Sotnikov, Scot Brown (67 / 107)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Data Types | TOC | Anonymous Funct ions 👉

Function calls in Clojure work the same as any mainstream languages, such as Python. The main difference is that the function name comes after the parenthesis in the Clojure version.

​ functionName(​param1,​ param2)

​ (​function-name​ param1 param2)

This difference can be explained very simply. The function call is just a list containing the function name and its parameters. In Clojure, a list is a special type of data structure reserved for creating callable expressions. To create a list data structure, we have to call the list function:

​ (list 1 2 3)

👈 Data Types | TOC | Anonymous Funct ions 👉

Web Development with Clojure, Third Edition by Dmitri Sotnikov, Scot Brown can be purchased in other book formats directly from the Pragmatic Programmers. If you notice a code error or formatting mistake, please let us know here so that we can fix it.

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.