January 2014
Intermediate to advanced
232 pages
5h 11m
English
Function calls in Clojure look very similar to those in other languages. Let’s look at calling a function in Python and in Clojure:
| | functionName(param1, param2) |
| | |
| | (function-name param1 param2) |
The main difference is that the function name comes after the paren in the Clojure version. This is because a function call is simply a list containing the function name and its parameters. A list is a special data structure in Clojure because the compiler expects the first argument in lists to be callable. If you wanted to create a list data structure, you’d call the list function.
| | (list 1 2 3) |
Read now
Unlock full access