- What makes Clojure different
- Clojure as a Lisp
- Clojure for parallel programming
In other languages, there is restriction on the type of parameter. In C, only variables and pointers. In Java, only primitive and reference types. In functional languages, values and functions. There is no such limitation in Lisps & Clojure.
First Class Functions
Code as Data
List Datatype – fundamental
- cons, first, rest; OOP languages – references to Objects
Tree structured execution. No syntax.
Data Abstraction – functions on lists
Forms, Uniform Syntax – Metaprogramming, Syntactic Abstraction, Parameter
Code have same structure as Data (cons, first, rest)
Execution model – functions working on data
Datatype and Protocol
Compound Data – Data Abstraction – with Sequence
(No need for a Class template.)
Higher Order Function (Control Abstraction) on Sequence
Common pattern of Data access: first and recursive rest on Sequence
- Localize thinking space
- Localize testing
- Easily parallelizable
In languages with non-uniform syntax, one has to define macro for each type of sentence. But Clojure, being a Lisp and having uniform syntax (sentence), doesn’t have that sort of restrictions.
Uniform Syntax, Forms
Code as Data
Programmable Programming Language
Other languages: Data or Function
Clojure / Lisps: Data or Function or Expression (Forms)
Function: Defined execution model.
Large scale development? Reusable libraries and framework? Real world modeling?
Each of the high level functions can be seen as taking inputs and returning output using the same recursive “list” model – functions working as data processors. Study.