English |  Español |  Français |  Italiano |  Português |  Русский |  Shqip

Developing a Clojure Edge

Why learn Clojure?

Clojure is an important language because it is fast.  Code can run as fast as its host platform.  Clojure is ubiquitous.  It can target the JVM, .NET and javascript.

Clojure is an aesthetic and practical language which has many qualities that you will be interested in.  I will point these out upfront and refer to them as we encounter them in a practical context.  To facilitate this I will use an acronym PRECISE.

Predictable

Deterministically understanding what has and will occur, based upon the outcomes of causality. Every action, or cause, produces a reaction, or effect, and every reaction, in turn, becomes the cause of subsequent reactions. The totality of these cascading events can show exactly how the system will exist at any moment in time.

Reason enabling

Referential transparency allows the programmer and the compiler to reason about program behavior. This can help the programmer in proving correctness, simplifying an algorithm, modifying code without breaking it. The compiler can optimize code by means of memoization, common subexpression elimination or parallelization. Freedom from a defined order of evaluation is good for expression and reasoning.

Ecosystem enabled

Leiningen is an excellent build automation and dependency management tool for the simple configuration of software projects.  It is a real pleasure to use.  Clojars hosts a wide and well maintained community of libraries.  Interop provides convenient access to every Java library out there.  Many popular libraries.

Composition friendly

Prefer composition over inheritance.

Interactive

Cut out the compile run test

Quickly test interfaces or ideas

Save repl as test cases

More fun

Simple

Modular

Do one thing well

Not intertwined

Expressive

Philip Wadler of Bell Labs coined the term Expression Problem in an unpublished paper that he circulated by email in 1998 (http://homepages.inf.ed.ac.uk/wadler/papers/expression/expression.txt). "The Expression Problem is a new name for an old problem. The goal is to define a datatype by cases, where one can add new cases to the datatype and new functions over the datatype, without recompiling existing code, and while retaining static type safety (e.g., no casts)."

Datatypes

Protocols

Multimethods

Clojure favors uniform interfaces, so it encourages storing structured data in maps

Terseness

DRY

Key ideas

  • Embrace an industry-standard, open platform.
  • Modernizing Lisp
  • Functional programming with immutable persistent data structures
  • Built-in concurrency support.

There has been error in communication with Booktype server. Not sure right now where is the problem.

You should refresh this page.