Clojure
Learn Clojure by typing real, functional Lisp.
Type your way into Clojure's Lisp syntax: persistent immutable data structures, pure higher-order functions, destructuring, and the -> and ->> threading macros that make nested calls readable. Each snippet is idiomatic Clojure, and an AI tutor explains every line — how a persistent map shares structure, why the threading macro reorders your reading — so the parentheses stop being scary.
Progress0 / 688 solved · 0/50 sections
best wpm
0
avg wpm
0
accuracy
0%
runs
0
level
1
rating
1000
Run Clojure on your machine
1. Install the toolchain
brew install clojure/tools/clojure # (needs a JDK)2. Save your code as hello.clj, then compile & run
clojure -M hello.cljprogress by section
1Fundamentals0/11start →
2Strings In Depth0/16start →
3Values & References0/14start →
4Slices & Arrays0/15Unlock →
5Data structures0/12Unlock →
6Iterators0/21Unlock →
filtermap into a vectorsum, product and countconcatcollect into a mapmap-indexedrange, step and reversereduce with an accumulatorreduce without a seedtake and dropiterate, repeat and cyclekeepmapcat and flattenmin-key and max-keypartition and group-byreductionssome, every? and findtake-while and drop-whilezip and unziplazy-seqTransducers
7Traits0/20Unlock →
Defaults via mergeAdding valuesComparators for sortComparable via comparedefprotocolValue equalityextend-protocolRecords as map keysCollect with intoConversion protocolProtocol default via Objectextend-type on a built-inMultimethod :defaultMultimethod dispatchFold into an aggregatereify a protocolFallible conversionContainer protocolIDeref (deref)Seqable type
8Generics0/18Unlock →
One fn, many typesGeneric over any seqcompareGeneric containerParametric via higher-orderGeneric minimumGeneric sort by comparatorBuild a value genericallyRecords are mapsStatic vs dynamic dispatchExtend built-in typesMultimethodsNewtype wrapperProtocolsRuntime protocol checkAd-hoc hierarchiesDispatch on many argsreify
9Lifetimes0/20Unlock →
let scopedoseq scopeNo manual lifetimesClosures captureReturning a closureif-let scopeCallees cannot mutateShadowingloop/recur localsStructural sharingA program-long constantImmutable substringwhen-let scopeCapturing an atomDynamic bindingdelay/forceReturn a valueLazy sequenceswith-open closes resourcesReverse-order close
10Closures0/20Unlock →
11Pattern Matching0/20Unlock →
Branch as an expressioncase for literalsMap :keysVector destructuringRest with &cond as guardscondpcore.match noteDestructuring fn paramsif-let / when-letMap defaults with :orHandling nil:as whole valueMap of handlersNested destructuringResult as a tagged vectorMatch a vector's shapeloop while a seq remainsDispatch on shapeNested recursive value
12Error Handling0/21Unlock →
try / catchassert an invariantRead the messageFall back on failurefinally for cleanupSwallow an errorThrow an errorOrdered handlersCatch a specific classReturn an error mapex-info and ex-dataKeep only successesRe-throwwith-open cleanupAdd context to an errorDispatch on ex-dataSeveral catch clausesPostcondition with :postPrecondition with :preWrap the causeStop at the first failure
13Option & Result0/20Unlock →
14Conversions0/15Unlock →
15Collection Conversions0/19Unlock →
16Math0/14Unlock →
17Encoding0/22Unlock →
String to bytesASCII checks and caseBytes to StringChar to code pointChar digit valueNumber in a baseBase64 decodeBase64 encodeList code pointsEscape a stringHex encodeBytes vs charsParse a number in a basePercent-decodePercent-encodeURL-safe Base64Big-endian bytesCaesar cipherHex decodeLittle-endian bytesROT13XOR cipher
18Random0/20Unlock →
Pick a random elementBasic randomnessCoin flipRandom number in a rangeSeed from the clockShuffle a collectionRandom f64 in [0, 1)Random bytesWeighted true/falseRandom keywordBounded nextIntPassword generatorSample without replacementSeeded generatorRandom alphanumeric stringRandom UUIDRoll many diceNormal distributionReproducible sequencesWeighted choice
19Data I/O0/18Unlock →
Parse CSV into rowsTab-separated valuesBuild a CSV stringSelect one columnCSV into a number matrixSplit off the headerWhitespace-separated matrixRead a data fileSkip blanks and commentsPrint an aligned tableWrite CSV to a fileWrite a matrix as textAppend a rowStream lines with a readerSerialize a map to JSONParse key=value configRound-trip write then readDrop unparseable rows
20Linear Algebra0/21Unlock →
Matrix shapeDot productScalar multiplyA matrix of zerosElementwise addArgmax of a vectorFlatten a matrixIdentity matrixOne-hot encodeTraceStack rows (vstack)ReLU and sigmoidColumn meansColumn sumsCosine similarityMatrix times vectorTransposeMatrix multiplyMin-max normalize columnsSoftmaxStandardize columns (z-score)
21Text Processing0/16Unlock →
22Date & Time0/12Unlock →
23Memory0/12Unlock →
24Modules0/20Unlock →
Vars in a namespacerequire :asNamespaced constantsKeywords as an enumPrivate functionsrefer :allrequire :referThe current namespaceAnother namespaceInspect a namespaceA record typeA utility namespaceVars vs valuesaliasForward declarationDynamic varsintern a varDotted namespacesA protocolrefer :rename
25Macros0/20Unlock →
assertA macro with no argumentsA macro with one argumentCapture a form as dataThreading macrosBuild a collectiongensym by handmacroexpand-1Multiple aritiesVariadic with ~@An unless macroA short-circuiting andAuto-gensymA macro that defines a varRun a body N timesA map macroA short-circuiting orCount argumentsMacro hygieneA recursive macro
26Testing0/20Unlock →
A plain assertTesting a truth tableA unit testis with a predicateMultiple testsAsserting inequalityTesting string outputDocstrings + a testTesting an error caseA test helperComparing mapsTesting nil vs a valueThe run-tests summaryGrouping with testingAsserting an exceptionComparing collectionsTable-driven testsA fixtureComparing floatsAsserting the message
27Algorithms0/10Unlock →
28Sorting Algorithms0/12Unlock →
29Expression Parsing0/6Unlock →
30Idioms0/9Unlock →
31OOP & Traits0/8Unlock →
32Trait Objects0/14Unlock →
Default behaviorReturn one of several typesDispatch through a protocolTwo protocols on one typeA vector of functionsVary the sequence typeDispatch on classreify capturing localsFreely shared valuesSum across mixed typesA vector of implementersMultimethod hierarchyA handler registryRecover the concrete type
33Design Patterns0/14Unlock →
34Async0/6Unlock →
35File I/O0/6Unlock →
36Filesystem0/18Unlock →
Does a path exist?Copy a fileFiles vs directoriesBuild a pathList a directoryCreate nested directoriesRename or moveChange the extensionFile metadataPath componentsRemove files and treesSorted listingCreate a temp directoryAbsolute pathFilter by extensionLast modified timeTotal size of a treeWalk the tree
37Networking0/16Unlock →
38Concurrency0/8Unlock →
39Unsafe & FFI0/14Unlock →
40Commands0/14Unlock →
41Array0/10Unlock →
43String0/10Unlock →
45Interval0/5Unlock →
46Linked List0/6Unlock →
47Tree0/14Unlock →
Maximum Depth of Binary TreeInvert Binary TreeSame TreeLowest Common Ancestor of a BSTBinary Tree Level Order TraversalSubtree of Another TreeImplement Trie (Prefix Tree)Kth Smallest Element in a BSTValidate Binary Search TreeAdd and Search WordConstruct Binary Tree from Preorder and InorderBinary Tree Maximum Path SumSerialize and Deserialize Binary TreeWord Search II