Local development environment






cycognito



clojure logo

Use tools like a professional Clojure developer

Professional tools are never easy to use for beginners
professional dj
guitarist fingers

Homoiconicity

The syntax of the code is the same as the syntax of the data.
(defn dummy
  "A dummy function"
  [n]
  (let [a (inc n)]
    a))
'(a b
  c
  [d.a d.b]
  (e.a [e.b.a (e.b.b.a e.b.b.b)]
    e.c)

Structural editing

Constraints are here to help you!

Paredit never lets your code become unbalanced

Practice Structural editing

Wrap expression

(println 1)

to

(when a (println 1))

Slurp forward and Barf backward

sort [1 2 3]

to

(sort [1 2 3])

Splice

  [1 2 3]

to

  1 2 3

Kill backwards

(when a (println 1))

to

(println 1)

Structural navigation

โ˜•The code is a tree.

Never use arrow keys to navigate in your code
'(a b
  c
  [d.a d.b]
  (e.a [e.b.a (e.b.b.a e.b.b.b)]
    e.c)

๐Ÿ‚ To navigate from b to e.a, we move forward twice and forward into sexp once

The REPL

REPL comes from the LISP tradition

REPL is much more than a shell or a browser console

The Remote Agent Experiment: Debugging Code from 60 Million Miles Away

The REPL connected to the IDE

  1. Evaluate the form that ends at caret

  2. Evaluate top form

  3. Evaluate the whole buffer

  4. Comment block

Debug without a debugger

spy

Homeworks

  1. Practice structural editing on your IDE

  2. Navigate the code without arrow keys

  3. Connect the REPL to your IDE

homeworks