Skip to content

Instantly share code, notes, and snippets.

@NguyenDa18
Last active January 13, 2020 21:16
Show Gist options
  • Save NguyenDa18/28aabbd242adc756c085fd3213737c37 to your computer and use it in GitHub Desktop.
Save NguyenDa18/28aabbd242adc756c085fd3213737c37 to your computer and use it in GitHub Desktop.
Clojure QuickStart

Working with the REPL

  • lein repl : To start
  • (pst) : Print stack trace
  • (load-file "myfile.clj") : Run a CLJ file
  • Results of 3 most recent expressions: *1, *2, *3
  • (require '[clojure.by.example :as cbe]) : Require namespace
  • (use 'clojure.lib) : Use library at the REPL
  • (lein test :only clj-testing.namespace.my-test) : Run a specific namespace tests
  • use lein-try to test out clojars in repl

Data Struct Syntax

  • #{} : Set, #{1 2 3 3 4} : Syntax error: Duplicate key: 3
  • (conj coll item) : Conjoin (append item to collection coll)

Atoms

  • (def my_atom_name (atom #{})) : Bind an empty set atom to the name

Projects

  • lein deps : Install dependencies from project.clj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment