In the past, I've written code like the following

(defn foo [x y]
  (let [x-squared (* x x)]
    (if (pos? y)
      (+ x-squared y)
      (- x-squared y))))

However, the introduction of as-> has led me to write the following, at times

(defn foo [x y]
  (as-> (* x x) x-squared
    (if (pos? y)
      (+ x-squared y)
      (- x-squared y))))

In essence, I've started replacing single binding lets with as->. John
Hume has pointed out that as-> seems to have been introduced to work
in conjunction with ->. Which brings me to my question - do you think
it's better to use a single binding let from a readability
perspective? Are there any (performance or otherwise) impacts that I
should be aware of?

Cheers, Jay

-- 
-- 
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