Clojure Programming

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Clojure is a dynamic programming language for the JVM.

Contents

[edit] Introduction

People come to Clojure from a variety of backgrounds. The purpose of this book is to help everyone get the most out of the Clojure language. It is not meant as a replacement for the documentation, found at the Clojure site. Please do not copy material from there to here!

Feel free to post your own code, written in the Clojure language, here. However, please do not post excerpts, patches or other modifications or derivations of the Clojure source itself, as the license of this Wiki is incompatible with the Clojure license. Instead, post such things to the Clojure discussion group.

[edit] FAQ

[edit] Getting started

The Getting started section covers obtaining and installing Clojure as well as basic setup of editors such as Emacs or Vim.

[edit] Concepts

The Concepts section covers Clojure language basics, such as supported datatypes, "mutability" or state in Clojure, functional programming and the concurrency features. Also see the book Learning Clojure.

[edit] Tutorials and Tips

By Example is an introductory look at Clojure that is heavy on examples to introduce the look and meaning of various constructs.

The Tutorials and Tips section covers differences with other languages and miscellaneous tutorials.

Learning Clojure gives an examination of Clojure's features.

[edit] Examples

This section is a cookbook with various Clojure examples, including

  • Using JDBC
  • Norvig's Spelling Corrector
  • Simple REPL on a Socket
  • Simple GUI : Temperature Converter
  • Lazy Fibonacci
  • Talking to Excel
  • genclass and finalize
  • Invoking Java method through method name as a String
  • Creating an Applet

[edit] API Examples

This section is for examples using the Clojure API

[edit] Cookbook

[edit] Links to more Examples

  • Sending Emails [1]
  • Chapter about music database from "Practical Common Lisp" translated to clojure [2]
  • "Practical Common Lisp" translated into Clojure [3]
  • Simple SparkLine Generator in Clojure [4]
  • Using Google Charts from Clojure [5]
  • Context Free Art [6]
  • Socket Programming Walkthrough [7]
  • Webjure: Simple Web Programming for Clojure [8]
  • Compojure: Another web framework for Clojure [9]
  • OpenGL Gears demo ported from JOGL demos [10]
  • OpenGL Tetrahedron ported from Wikipedia JOGL example [11]
  • Image Processing examples using ImageJ and Clojure (via Fiji) [12]
  • Destructuring bind in def [13]
  • Embedded REPL (Interactive production applications) [14]
  • Generating the digits of PI in Clojure [15]
  • A Quine in Clojure [16]
  • Simple Pong game in Clojure [17]

[edit] Reference

See the website: [18]

Further Reading

In other languages