PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Clojure

Clojure

Clojure is a programming language created in 2007 by Rich Hickey.

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...

Try now: Riju ยท TIO ยท Replit

#29on PLDB 15Years Old 44.9kUsers

Example code from Riju:

(println "Hello, world!")

Example code from hello-world:

(println "Hello World")

Example code from the Hello World Collection:

; Hello world in Clojure (defn hello [] (println "Hello world!")) (hello)

Example code 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 code from Wikipedia:

([382 318 466 963 619 22 21 273 45 596] [808 639 804 471 394 904 952 75 289 778] ... [484 216 622 139 651 592 379 228 242 355]) Distinct: 1000

Language features

Feature Supported Example Token
Integers โœ“
; -?\d+
Floats โœ“
; -?\d+\.\d+
Hexadecimals โœ“
; 0x-?[abcdef\d]+
MultiLine Comments โœ“
(comment A comment
)
(comment )
Print() Debugging โœ“ println
Homoiconicity โœ“
Line Comments โœ“
; A comment
;
Operator Overloading โœ“
Macros โœ“
https://clojure.org/reference/macros
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)
(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"
"
Semantic Indentation ฯด

Trending Clojure repos on GitHub

repo stars description
FiraCode 38337 Monospaced font with programming ligatures
status-react 2759 "a free (libre) open source mobile OS for Ethereum"
clojure-koans 3168 A set of exercises for learning Clojure
re-frame 3897 "A Reagent Framework For Writing SPAs in Clojurescript."
metabase 16675 "The simplest fastest way to get business intelligence and analytics to everyone in your company ๐Ÿ˜‹"
ring 2869 Clojure HTTP server abstraction
LightTable 10751 The Light Table IDE โ›บ
reagent 3544 A minimalistic ClojureScript interface to React.js

Books about Clojure on goodreads

title author year reviews ratings rating
Programming Clojure Stuart Halloway 2009 45 559 3.82
Clojure Programming Chas Emerick 2011 30 423 4.18
Clojure Reactive Programming Leonardo Borges 2015 1 21 3.81
Clojure Cookbook: Recipes for Functional Programming Luke VanderHart 2014 5 55 3.75
Clojure High Performance Programming Shantanu Kumar 2013 4 19 2.84

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements ยท Email ยท GitHub