XCODX |

Clojure Online Compiler & Interpreter

Select Language
Online Code Compiler
Full HTML IDE
Py main.py
Program Output Ready
  Welcome to XCODX Online Compiler

  Quick Start:
  Ctrl+Enter  Run code
  Ctrl+S      Save / Download
  Ctrl+L      Clear output

  Select a language and start coding.
Success
Operation completed

About Clojure

Clojure is a modern Lisp created by Rich Hickey and first released in 2007, designed to run on the Java Virtual Machine. It is a dynamically typed, functional language built around immutable, persistent data structures and a small set of composable core functions. Because it compiles to JVM bytecode, Clojure programs can call Java classes directly and lean on that host platform instead of reinventing a runtime. Its code is written as data — the parenthesized s-expressions of the Lisp family — which makes macros and code transformation first-class. On XCODX, Clojure runs in a cloud sandbox, so you can try the core language and its immutable collections without installing a JDK or a build tool.

Hello World in Clojure

(require 'clojure.string)

;; Clojure on the JVM: immutable data and higher-order functions
(println "Type a sentence, then press Enter:")
(let [line (read-line)
      words (remove clojure.string/blank? (clojure.string/split (or line "") #" "))]
  (println "Word count:" (count words)))

(println "First five squares:" (mapv #(* % %) (range 1 6)))

When to use Clojure

Clojure shines when you want expressive, data-centric code with strong support for immutability and concurrency, and its JVM foundation gives real projects access to a mature ecosystem of Java libraries. Teams reach for it in backend services, data pipelines, and anywhere reliable state management matters. It is a natural fit if you like Lisp's flexibility but want to deploy on the JVM. It is a poor fit for tiny scripts or latency-sensitive command-line tools, since JVM startup adds noticeable overhead before your code even begins.

Common questions

How do I read user input in Clojure?

Use (read-line), which pulls one line of text from standard input (*in*). On XCODX you can type into the live terminal — the program pauses at read-line until you press Enter — or paste everything into the Stdin Box before running. Pressing Ctrl+D closes the input stream, after which read-line returns nil.

Can I add dependencies with Leiningen or deps.edn?

No. The sandbox has no build tool and no network access, so there is no Leiningen, no deps.edn resolution, and no way to pull libraries like core.async or Ring. Only Clojure's built-in namespaces such as clojure.string, clojure.set, and clojure.walk are available, alongside the standard Java classes on the JDK.

Why does my Clojure program take a moment to start?

Clojure compiles to Java bytecode and runs on the JVM, which has to boot before your code executes. That startup cost is normal, but keep the short run timeout in mind and avoid heavy work that would push a quick demo past the limit.

Is this Clojure or ClojureScript?

This runs Clojure on the JVM, not ClojureScript. There is no JavaScript target, no browser, and no npm; your code is compiled and executed server-side, with plain text sent to the terminal.

Can I use Java interop in the sandbox?

Yes. Classes from the Java standard library are on the classpath, so calls like (Math/sqrt 2) or (java.time.LocalDate/now) work. What you cannot do is load external JARs, since there is no dependency resolution and no network.

Which Clojure version does XCODX run?

The exact runtime version is shown in the badge next to the editor. It is a fixed build with no signup and no local setup required, and every run starts from a clean environment with no saved files.

How Clojure runs on XCODX

Sandbox filename
main.clj
Entry point
single main source file
Editor grammar
clojure
Reading stdin
read-line
Input delivery
live WebSocket stream
Prompt flushing
flush manually before reading input
Compile limit
10 s
Run limit
3 s batch · up to 3 min live
Memory
256 MB per stage
Max source
50,000 characters

Default program on this page

(println "Hello from Clojure!")
(println "Welcome to XCODX Online Compiler!")
(def message "Clojure is a Lisp!")
(println message)