Clojure

Welcome to the Wikiversity project for Clojure, part of the Division of Computer Programming. The aim of this course is to get you fluent in Clojure programming by completing modular coding drills. Each lesson has a different technique with some explanation about what you're doing, followed by the drills.

A major goal of this course to have a smooth learning curve, so we take care not to mix advanced terms and topics with basic or intermediate ones. If we need to refer to concepts from other languages to explain why something happens in Clojure, you'll get plenty of notice and the chance to read a nutshell version.

As much as possible, this is a jargon-free course. If you come across a word or phrase you don't know, or see a word used in a weird way, please look it up on Wikipedia to see what you're missing. Attempting to push forward when something is unclear assumes that the unclear part is unimportant, and that's almost never the case.

Note to contributors: This course has been started with the intent to satisfy Open Study Tech requirements, which means that contributors must:

do everything reasonable to ensure that text can be fully understood, including replacing jargon terms with plain English.

encourage readers to type out example code themselves, so they can verify that it works and gain first-hand experience.

ensure that all topics are presented in a logically-determined order so readers can progress comfortably to the next level.

Contents

Clojure is a unique programming system designed to run on the JVM platform (Java Virtual Machine). Clojure mixes elements from several language families (notably ALGOL and LISP), and can be best described as an object-oriented / list processing hybrid. The Clojure language itself is not intended to be used in an object-oriented way, but Clojure is nonetheless written in Java and that underlying foundation does poke through from time to time. Because of this, Clojure is best not considered as a LISP dialect so much as a Java-based LISP simulator.

Clojure programming requires getting comfortable with a challenging paradox. Its goal is to simulate an interactive, dynamic programming environment via the use of a virtual machine. The nature of virtual machines is that they adopt a specific personality for as long as they run, and that personality is set by a pre-compiled, fixed main program. Virtual machines are typically special-purpose and limited to a particular task, done in a particular way. This mirrors the days of computing before operating systems were invented, when engineers literally had to rewire a machine between restarts to make it do different things. Clojure is therefore a bit like a leap into the operating system era; it allows a single VM to change its behavior and abilities even after it has been started.

In a way, Clojure can be seen as a souped-up calculator that has a command line instead of buttons, and can run code in batches if needed. This is a drastic oversimplification of course but it's an approachable metaphor to begin with.

Properly understanding Clojure requires some knowledge of several topics including: operating systems, virtual machines, Java, LISP, lambda notation, object-oriented programming, functional programming, and the history of programming language families. Clojure is exciting because it allows for fun, instant-feedback noodling as well as the development of powerful, professionally-deployed software. It has the benefit of running on a popular platform, the JVM, so it can be used in business or consumer settings without special requirements.

However, because of Clojure's mixed heritage it's only fair to say that it does require more technical knowledge than is usually necessary.

Wikiversity participants should use and help develop the the book Programming Clojure at Wikibooks and make use of Wikipedia.

Wikiversity learning resources should not take the form of a general encyclopedia article, textbook or manual: Wikiversity is for other types of learning resources. Wikiversity has a "learn by doing" approach to e-learning, so learning projects are particularly useful. Design activities and projects for Wikiversity participants and attempt to establish a collaborative learning environment.

Please sign below if you are participating in this topic. Use 4 tildes (~) to sign. Please note that if you have not previously created a username here at Wikiversity when signing below it will only display your IP address, which may change frequently.