background preloader

Learn Clojure

Facebook Twitter

Clojure Tutorial For the Non-Lisp Programmer | Moxley Stratton. I intend to keep this tutorial as accurate and up-to-date as possible. If you have any suggestions for changes, please leave a comment at the bottom of this page. Clojure is a functional lisp dialect that uses the Java Virtual Runtime as its platform. The language home page is at Table of Contents A Quick Comparison In C-like languages, a function call might look something like this: In Clojure, the same function call would look like this: Here, Clojure’s syntax differs in these ways: The opening parenthesis is to the left of the function name.There are no commas delimiting the function parameters.By convention, words in a function name are separated by dashes.

There’s not a huge difference. Here’s how adding two values might look in a C-like language: And here’s how it would look in Clojure: In C, the plus operator goes in between the two operands. Installing Clojure A fast and easy way to get started with Clojure is to download and run Clooj. Numbers Booleans Nil Strings Symbols.

Clojure Tutorials. Fast Track Clojure. Object Computing, Inc. - Java News Brief - March 2009. By R. Mark Volkmann, Partner Object Computing, Inc. (OCI) last updated on 6/2/13 Contents Introduction The goal of this article is to provide a fairly comprehensive introduction to the Clojure programming language. Please send feedback on errors and ways to improve explanations to mark@ociweb.com, or fork the repository and send a pull-request. You said X, but the correct thing to say is Y. Updates to this article that indicate the "last updated" date and provide a dated list of changes will be provided at Code examples in this article often show the return value of a function call or its output in a line comment (begins with a semicolon) followed by "->" and the result. (+ 1 2) ; showing return value -> 3 (println "Hello") ; return value is nil, showing output -> Hello Functional Programming Functional programming is a style of programming that emphasizes "first-class" functions that are "pure".

In practice, applications need to have some side effects. Intro to Clojure - 1 of 10.