Here's your second implementation cleaned up a little:

(defn perimeter [& pn]
  (apply +
    (map euclidean-distance pn (rest pn))))

My own personal opinion is:
The second approach is
(1) faster to write
(2) easier to understand
(3) less error-prone
So that's the one that I prefer.

IF the first form turns out to perform much better (and I'm not clear
as to why this is happening) and the performance is necessary. THEN I
would re-write the function using loop-recur. Or better yet, write a
macro that preserves the elegance of the second form, but expands into
a specialized loop-recur.

Hope this helps
  -Patrick

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

Reply via email to