Let us say you had this:

(defn create-new-canvas-text [inputs]  
  (let [{text-selected-id :new} (dataflow/old-and-new inputs [:design 
:params :text :selected-id])
        {text-params :new} (dataflow/old-and-new inputs [:design :params 
:text])
        text-value (:value text-params)

        ]
    ;; When there is no previous selected id and there is now non-empty 
text in the params text
    ;; it means that a new canvas text entry should occur
    (when
        (and (nil? text-selected-id) (not (empty? text-value)))
      ;; Get the previous text entries in canvas
      ;; Create a new key, which will become selected-id
      ;; Add the new text entries into canvas
                    (let [{prev-text :new} (dataflow/old-and-new inputs 
[:design :canvas :text])
                  old-keys (keys prev-text)
            new-id (if (seq old-keys) (inc (apply max (keys old-keys))) 0)
            new-text (assoc old-keys new-id (select-keys text-params 
[:value]))]                
        [
         ^:input {msg/topic [:design :params :text :selected-id] msg/type 
:set-value :value new-id}
         ^:input {msg/topic [:design :canvas :text] msg/type :set-value 
:value new-text}]))


    )

  )

Is there a way to get it into this:

(defn create-new-canvas-text [inputs]  
  (let [{text-selected-id :new} (dataflow/old-and-new inputs [:design 
:params :text :selected-id])
        {text-params :new} (dataflow/old-and-new inputs [:design :params 
:text])
        text-value (:value text-params)]
    ;; When there is no previous selected id and there is now non-empty 
text in the params text
    ;; it means that a new canvas text entry should occur
    (when (and (nil? text-selected-id) (not (empty? text-value)))
      ;; Get the previous text entries in canvas
      ;; Create a new key, which will become selected-id
      ;; Add the new text entries into canvas
      (let [{prev-text :new} (dataflow/old-and-new inputs [:design :canvas 
:text])
            old-keys (keys prev-text)
            new-id (if (seq old-keys) (inc (apply max (keys old-keys))) 0)
            new-text (assoc old-keys new-id (select-keys text-params 
[:value]))]                
        [^:input {msg/topic [:design :params :text :selected-id] msg/type 
:set-value :value new-id}
         ^:input {msg/topic [:design :canvas :text] msg/type :set-value 
:value new-text}]))))


Seems like it would be a combination of indent-sexp, and then identifying 
unnecessary white space and deleting it.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to