Difference between revisions of "Clojure"

From ArchWiki
Jump to: navigation, search
m (+ i8n)
(Running Clojure Programs)
Line 15: Line 15:
 
Or you can get the git version from the AUR: [http://aur.archlinux.org/packages.php?ID=27389 clojure-git].
 
Or you can get the git version from the AUR: [http://aur.archlinux.org/packages.php?ID=27389 clojure-git].
  
== Running Clojure Programs ==
+
== REPL ==
Here is a small script to run the Clojure REPL from the command line.
+
To run the REPL, install [http://leiningen.org/ leiningen] from [http://aur.archlinux.org/packages.php?ID=37278 here].  Then in a terminal type
#!/bin/sh
+
  lein repl
breakchars="(){}[],^%$#@\"\";;''|\\"
 
CLOJURE_DIR=/usr/share/clojure
 
CLOJURE_JAR="$CLOJURE_DIR"/clojure.jar
 
if [ $# -eq 0 ]; then
 
    exec rlwrap --remember -c -b "$breakchars" \
 
        -f "$HOME"/.clj_completions \
 
        java -cp "$CLOJURE_JAR" clojure.main
 
  else
 
    exec java-cp "$CLOJURE_JAR" clojure.main $1 -- "$@"
 
  fi
 

Revision as of 23:00, 29 March 2012

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Template:Article summary start Template:Article summary text Template:Article summary end

Clojure is a dynamic programming language that targets the Java Virtual Machine (and the CLR, and JavaScript). It is designed to be a general-purpose language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming. Clojure is a compiled language - it compiles directly to JVM bytecode, yet remains completely dynamic. Every feature supported by Clojure is supported at runtime. Clojure provides easy access to the Java frameworks, with optional type hints and type inference, to ensure that calls to Java can avoid reflection.

Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system. Clojure is predominantly a functional programming language, and features a rich set of immutable, persistent data structures. When mutable state is needed, Clojure offers a software transactional memory system and reactive Agent system that ensure clean, correct, multithreaded designs.

Installation

Clojure can be installed via

# pacman -S clojure

Or you can get the git version from the AUR: clojure-git.

REPL

To run the REPL, install leiningen from here. Then in a terminal type

lein repl