Top 1,000 Features Creators Resources Extensions Blog Explorer CSV Download
GitHub icon


< >

Clojure is an open source programming language created in 2007 by Rich Hickey.

#27on PLDB 17Years Old 82kRepos
Download source code:
git clone

Try now: Riju ยท TIO ยท Replit

Clojure ( , like "closure") is a dialect of the Lisp programming language. Clojure is a general-purpose programming language with an emphasis on functional programming. It runs on the Java virtual machine and the Common Language Runtime. Read more on Wikipedia...

Example from Riju:
(println "Hello, world!")
Example from hello-world:
(println "Hello World")
; Hello world in Clojure (defn hello [] (println "Hello world!")) (hello)
Example from Linguist:
(defn rand "Returns a random floating point number between 0 (inclusive) and n (default 1) (exclusive)." ([] (scm* [n] (random-real))) ([n] (* (rand) n)))
Example from Wikipedia:
;; A typical entry point of a Clojure program: ;; `-main` function (defn -main ; name [& args] ; (variable) parameters (println "Hello, World!")) ; body

Language features

Feature Supported Token Example
Integers โœ“
; -?\d+
Floats โœ“
; -?\d+\.\d+
Hexadecimals โœ“
; 0x-?[abcdef\d]+
MultiLine Comments โœ“ (comment )
(comment A comment
Print() Debugging โœ“ println
Homoiconicity โœ“
Line Comments โœ“ ;
; A comment
Operator Overloading โœ“
Macros โœ“
(defmacro and
 "Evaluates exprs one at a time, from left to right. If a form
 returns logical false (nil or false), and returns that value and
 doesn't evaluate any of the other expressions, otherwise it returns
 the value of the last expr. (and) returns true."
 {:added "1.0"}
 ([] true)
 ([x] x)
 ([x & next]
  `(let [and# ~x]
     (if and# (and ~@next) and#))))
File Imports โœ“
(load "fun")
(load "files/fun")
(load-file "./files/fun.clj")
(defproject project-a
:dependencies [[org.clojure/clojure "1.5.1"]
              [project-b "0.1.0"]])
(require '[clojure.string :as string])
(use '[clojure.string :only [split]])
(import 'java.util.Date)
(require 'clojure.contrib.def 'clojure.contrib.except 'clojure.contrib.sql)
(require '(clojure.contrib def except sql))
Comments โœ“
Partial Application โœ“
(defn fun-full [x y] (+ x y))
(fun-full 2 3)
(def fun-half (partial fun-full 2))
(fun-half 3)
Strings โœ“ "
"hello world"
Lispy โœ“
Case Insensitive Identifiers X
Semantic Indentation X

View source

- Build the next great programming language ยท About ยท Acknowledgements ยท Part of the World Wide Scroll