For what it's worth, I found that working with complex numbers in
clojure doesn't require specialist types or notation at all:

(defn complex-times [[a_re a_im] [b_re b_im]] [(- (* a_re b_re) (*
a_im b_im)) (+ (* a_re b_im) (* a_im b_re))])
(defn complex-plus  [[a_re a_im] [b_re b_im]] [(+ a_re b_re) (+ a_im
b_im)])
(defn complex-minus [[a_re a_im] [b_re b_im]] [(- a_re b_re) (- a_im
b_im)])
(defn complex-abs [[re im]] (Math/hypot re im))

(prn (complex-abs (complex-plus [1.5 1] (complex-times [1 -2] [2
-1]))))

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