www.braveclojure.com/getting-started/
1 Users
0 Comments
30 Highlights
0 Notes
Tags
Top Highlights
First Things First: What Is Clojure?
Clojure was forged in a mythic volcano by Rich Hickey
Its Lisp heritage gives you the power to write code more expressively than is possible in most non-Lisp languages, and its distinct take on functional programming will sharpen your thinking as a programmer
the distinction between the Clojure language and the Clojure compiler
The Clojure language is a Lisp dialect with a functional emphasis whose syntax and semantics are independent of any implementation. The compiler is an executable JAR file, clojure.jar, which takes code written in the Clojure language and compiles it to Java Virtual Machine ( JVM) bytecode
Clojure programs are executed within a JVM and rely on the JVM for core features like threading and garbage collectio
Leiningen
These days, most Clojurists use Leiningen to build and manage their projects.
A single Leiningen command creates a project skeleton
lein new app clojure-noob
The first file of note is project.clj at ➊, which is a configuration file for Leiningen. It helps Leiningen answer such questions as “What dependencies does this project have?” and “When this Clojure program runs, what function should run first?”
save your source code in src/<project_name>
The test directory at ➍ obviously contains tests, and resources at ➋ is where you store assets like images.
Running the Clojure Project
The lines at ➊ declare a namespace
The -main function at ➋ is the entry point to your program
lein run
Building the Clojure Project
you can create a stand-alone file
lein uberjar
Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.