-
Notifications
You must be signed in to change notification settings - Fork 112
cljr expand let
Magnar Sveen edited this page Apr 3, 2015
·
1 revision
Find the closest let and move it up one level in the syntax tree.

Given I have my cursor at find-body here:
(defn handle-request
{:status 200
:body (let [body (find-body abc)]
body)})I do cljr-expand-let, and the let form is moved up:
(defn handle-request
(let [body (find-body abc)]
{:status 200
:body body}))It also replaces identical entries in the newly embraced body:
(defn create-entity
{:created-at (let [date (Date.)]
date)
:updated-at (Date.)})
turns into:
(defn create-entity
(let [date (Date.)]
{:created-at date
:updated-at date}))