On May 19, 2009, at 14:28, aperotte wrote:

> Let me know if you have any questions or comments!

Indexing:

(def data [[1 2] [3 4] [5 6]])
(def m (PersistentMatrix/create (int-array [1]) true))

-> #<PersistentMatrix
[[1, 2]
[3, 4]
[5, 6]]>


(.index m (int-array [0 1]))
-> 3
(-> m (nth 0) (nth 1))
-> 2

I'd expect the last two expressions to yield the same value, but  
apparently the index method treats indices in reversed order.

(.index m (int-array [1]))
-> 2

Apparently the index array is extended with zeros until it matches  
the number of dimensions. Again, I'd rather expect to get the same  
result as with (nth m 1).

So I wonder what the principle behind indexing is supposed to be.

Konrad.

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