Skip to Main Content
Programming Clojure, 3rd Edition
book

Programming Clojure, 3rd Edition

by Alex Miller, Stuart Halloway, Aaron Bedra
February 2018
Intermediate to advanced content levelIntermediate to advanced
304 pages
7h 11m
English
Pragmatic Bookshelf
Content preview from Programming Clojure, 3rd Edition

Navigating Clojure Libraries

Clojure code is packaged in libraries. Each Clojure library belongs to a namespace, which is analogous to a Java package. You can load a Clojure library with require:

 (require quoted-namespace-symbol)

When you require a library named clojure.java.io, Clojure looks for a file named clojure/java/io.clj on the CLASSPATH. Try it:

 user=>​ (require ​'clojure.java.io​)
 -> nil

The leading single quote () is required, and it quotes the library name. The nil returned indicates success. While you’re at it, test that you can load the sample code for this chapter, examples.introduction:

 user=>​ (require ​'examples.introduction​)
 -> nil

The examples.introduction library includes an implementation of the Fibonacci ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Kotlin

Programming Kotlin

Venkat Subramaniam
Getting Clojure

Getting Clojure

Russ Olsen

Publisher Resources

ISBN: 9781680505719Errata Page