background preloader

Clojure

Facebook Twitter

Counterclockwise - Project Hosting on Google Code. Fortum.se. Building Websites In Clojure by Dave Moore on Prezi. Music as data. Www.landoflisp.com. Logga in för att läsa. Swannodette/enlive-tutorial - GitHub. Basic Clojure Setup – Part 1: Installing Clojure. In February 2009, I wrote 3 posts that were meant to help new users with the initial setup of Clojure. Since then, many things have changed in Clojure world and my posts became quite outdated. There is also much more information available on Clojure than was available in early 2009.

So, I’m consolidating the posts (and removing old comments as they are no longer relevant) keeping only the most basic information that is still valid in 2011. Even though these instructions are geared towards Mac users, they should work for other Unix-like systems with small (if any) changes. I hope it saves some time to anyone new to Clojure. Clojure runs on JVM, so you will need to download the latest JDK from Sun (for Windows and Linux) or Apple (on OS X). JAR files are Java libraries that can be used by other Java programs. I found that keeping all of the JARs (or symbolic links to them) in one directory is a great way to keep things organized. Mkdir /opt/jars for i in `ls /opt/jars/*.jar` do done. How to create a Clojure application. Update: this is not my preferred way to create a Clojure application and shouldn’t be yours either, check out Leiningen This is one of those posts that I publish partly for myself.

How to create a Clojure application

And partly so people can criticize my way, which is also for myself, and only incidentally for others to learn from it. It seems Maven is popular in the Clojure world. Clojure itself uses it, Webjure uses and its demo application uses it as well, there’s a branch for Compojure that uses too. So after building all those components using Maven I’ve decided to use it myself when building Clojure applications. Talios/clojure-maven-plugin - GitHub. How do I connect to a MySQL database from Clojure. Getting Started with Eclipse and Counterclockwise. Clojure Programming - Wikibooks, collection of open-content textbooks.

Clojure is a dynamic programming language for the JVM.

Clojure Programming - Wikibooks, collection of open-content textbooks

Introduction[edit] People come to Clojure from a variety of backgrounds. ClojureDocs - clojure.contrib.string/substring? Clojure Programming/Examples/API Examples/Sequences. Interpose[edit] user=> (apply str (interpose "|" ["hi" "mum" "and" "dad"]))"hi|mum|and|dad" interleave[edit]

Clojure Programming/Examples/API Examples/Sequences

Clojure Programming/Examples/API Examples. This page gives example usage for Clojure API function calls.

Clojure Programming/Examples/API Examples

For a more general introduction to Clojure by example please see Documentation[edit] This page provides examples for the following functions. Clojure Web Development with Ring. This post provides an introduction Clojure web development with Ring, a Clojure web application library.

Clojure Web Development with Ring

If you are just getting started with Clojure web development or if you are interested in the new Ring 0.2 release, this is a great place to start. Before getting started, ensure that you have Leiningen 1.1.0 installed. We will be using Leiningen via the lein command to manage dependencies. Check your Leiningen install with: Once you have Leiningen set up, create a new ring-tutorial project: lein new ring-tutorial cd ring-tutorial Now edit the project.clj so that it looks like this: Clojure Programming/Examples/Cookbook. Binding[edit] How to do structural binding or destructuring in function argument lists or let bindings.

Clojure Programming/Examples/Cookbook

[edit] Instead of accessing values in a map like this: Object Computing, Inc. - Java News Brief - March 2009. By R.

Object Computing, Inc. - Java News Brief - March 2009

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 Also see my article on software transactional memory and the Clojure implementation of it 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.

Clojure: partial and comp. Clojure provides a few different options for creating functions inline: fn (or the #() reader macro), partial, and comp.

Clojure: partial and comp

When I first got started with Clojure I found I could do everything with fn and #(); and that's a good place to start. However, as I produced more Clojure code I found there were also opportunities to use both partial and comp to create more concise code. The following examples are contrived. They will show how partial and comp can be used; however, they aren't great examples of when they should be used. As always, context is important, and you'll need to decide when (or if) you want to use either function. The partial function takes a function and fewer than the normal arguments to the function, and returns a function that takes a variable number of additional args. The partial function can often be used as an alternative to fn or #().

Str-utils2 API reference (clojure-contrib) By Stuart Sierra Usage: (ns your-namespace (:require clojure.contrib.str-utils2)) Overview.

str-utils2 API reference (clojure-contrib)