It wasn't designed for Clojure originally, but I have an immutable "grid" 
persistent data structure in Java that I've used with some success in 
Clojure. It works nicely and efficiently with Clojure idioms because it is 
a proper persistent data structure (with a 64-way branching factor).

https://github.com/mikera/mikera/blob/master/src/main/java/mikera/engine/PersistentTreeGrid.java

It's actually a 3D grid, but you can use just 2 dimensions and keep the 3rd 
set to zero.


On Friday, 2 August 2013 01:59:40 UTC+1, JvJ wrote:
>
> I'm looking for an associative data structure that can be accessed by both 
> rows and columns, and could potentially be sparse.
>
> Suppose the following table is called t:
>
> |   | :A   | :B   | :C       ||---+------+------+----------|| 1 |      |      
> | '[x y z] || 2 | "2a" | "2b" |          || 3 |      |      |          || 3 | 
> :3a  |      | "Foo"    |
>
>
> Then (t :A) would return {2 "2a", 3 :3a}, and (t 2) would return {:A "2a", 
> :B "2b"}.
> (t :A 2) or (t 2 :A) would return "2a".
>
> I'm thinking of implementing it as a simple map of maps with some extra 
> functions, but I'm not sure if
> that would be the best option.
>
>
>

-- 
-- 
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/groups/opt_out.


Reply via email to