Hi,

I'm trying to create a matrix, basically it's a vector of vectors. I copied the 
code from ants.clj to create the matrix, however, I have to mirror the matrix 
around it's main diagonal (see below). Currently I'm doing this by first 
creating the matrix like this:
(apply vector (map (fn [i]
  (apply vector (map (fn [j] j) n))) n))))))

Where n is a range. After doing this I basically repeat the same thing, now 
mirroring the matrix around it's main diagonal. While this works, it's ugly and 
inefficient, and I'm wondering if there is a better of way of doing this. Below 
is a diagram of how it should look.

   | 1 | 2 | 3 | 
----------------
 1 | 0 | A | B |
----------------
 2 | A | 0 | C |
----------------
 3 | B | C | 0 |
----------------

The 0's on the diagonal just mean that the diagonal is ignored, A, B and C are 
ref's.

- Tiemo.


-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to