On Sat, Aug 8, 2015 at 12:39 PM, kirby urner <kirby.ur...@gmail.com> wrote:

>
> (defrecord XYZray [OX OY OZ]
>    VectorOps
>    (norm [this] (this))
>

Should be (norm [this] this) not (norm [this] (this)), because the latter
will try to invoke `this` as a function.

(defn qray-to-xyzray
  [qray]
  (let [[a] [(:OA qray)]
        [b] [(:OB qray)]
        [c] [(:OC qray)]
        [d] [(:OD qray)]
        [x] [(* (/ 1 (Math/sqrt 2))(+ (- (- a b) c) d))]
        [y] [(* (/ 1 (Math/sqrt 2))(- (+ (- a b) c) d))]
        [z] [(* (/ 1 (Math/sqrt 2))(- (- (+ a b) c) d))]]
    (XYZray. x y z)))


You have excessive, unnecessary brackets in your let clause.  Should look
like this:

(defn qray-to-xyzray
  [qray]
  (let [a (:OA qray)
        b (:OB qray)
        etc....

Your way "works" because basically you are building two extra vectors which
are implicitly getting destructured, but that's syntactically noisy and
also a lot of extra computational work that is unneeded.

-- 
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/d/optout.

Reply via email to