Paredit Basics

The | character is where our cursor is for purposes of visualizing where to invoke these methods.

paredit-wrap-round

Let’s wrap the 2 here.

(+ 1 |2 3 4)
;; Keybinding M-(
(+ 1 (2) 3 4)

paredit-forward-slurp-sexp

And after we wrap the 2, we type * and want to slurp in the 3.

(+ 1 (* |2) 3 4)
;; Keybinding C-)
(+ 1 (* 2 3) 4)

paredit-forward-barf-sexp

Oops, we slurped in the 4 by accident! Let’s unslurp it by barfing it out.

(+ 1 (* 2 3 |4))
;; Keybinding C-}
(+ 1 (* 2 3) 4)

paredit-splice-sexp-killing-backward

(def process-bags
     (comp
      (mapcatting unbundled-pallet)
      (filtering non-food?)|
      (mapping heavy-label)))
;; Keybinding M-⬆
(def process-bags
     (mapping heavy-label))