be considered functional, its notion of ‘function’ must be first-class: The functions of a language must be able to be stored, passed, and returned just like any other piece of data within that language. Wednesday 15 May 13
Designed by John McCarthy. Thanks John! • Lisp code is expressed as Lisp data structures. Allows for macros, where you can put code in your code so you can code as you code. This is ‘homoiconicity’. Wednesday 15 May 13
else conditional. • Automatic garbage collection. • An astonishing amount of parenthesis. • Didn’t take off because hardware sucked back then. Wednesday 15 May 13
• Designed for concurrency - use multiple cores. • Symbiotic with JVM (and CLR, JavaScript). • Just 6 years old. • AWESOME open-source community. Seriously. Wednesday 15 May 13
• Don’t complect state and behaviour. • Compose small, usually pure functions. • Immutable, persistent data structures. • Be explicit about identity, values, and state. Wednesday 15 May 13
that alter them in place. • Composition requires work: interfaces. Yay. • Hides data away inside type hierarchy. • Noun-centric approach to problem solving. • Defines functions that transform generic data structures. • Composition is simple and natural. • Exposes data. • Verb-centric approach to problem solving. http://goo.gl/b9JkF Wednesday 15 May 13
operate only on their inputs without causing side-effects. • A pure function will always return the same result for the same inputs. • Any time a function alters state or performs I/O, it is impure; it causes side-effects. Wednesday 15 May 13
This means, once a value exists, it can not be changed. • You can change what value your local binding pointing at, but you can’t alter that value. • Clojure’s let special form provides the ability to create lexical bindings. Wednesday 15 May 13
do I, you know, alter data?” • Functions return a copy of the data you provide with the transformations applied. • With the capability let provides, you can keep (or discard) successive values of your data as you transform it, without affecting that data for any other consumers of it. Great for concurrency! Wednesday 15 May 13
memory! That’s a performance no-no!” • Clojure’s immutable data structures are persistent; because they are immutable, they can share internal structure! Check it out: Wednesday 15 May 13
data orientation, Clojure forces you to think carefully about how and when your state changes. • When you can’t avoid it, Clojure provides four distinct mechanisms - the reference types - which allow changing state in a controlled manner. Wednesday 15 May 13
OOPs, and is therefore easier to do. • Clojure is a great modern FP language that you can use for just about anything. • Cats are awesome. And bacon. Bacon is awesome. Wednesday 15 May 13
meet this Saturday, May 18th from 9am at codebridge.co.za. • We’ll properly introduce Clojure, live-code a small web app, and take a look at ClojureScript and Datomic - a new database built on the same principles as Clojure! • Come join us! • Follow @clj_ug_ct on Twitter or visit http://www.siliconcape.com/group/clojure-ct Wednesday 15 May 13