I am doing my second homework working with Clojure and am having difficulty getting a value at a specified index from a hash map. Currently I have a function to create a vector of hash maps that represent a graph. I then index into that vector to get a specific hash map representing a node, specifically the nodes connections to other nodes; as such
homework2.core> (reg-ring-lattice 5 2)
[#{1 4} #{0 2} #{1 3} #{4 2} #{0 3}]
homework2.core> ((reg-ring-lattice 5 2) 2)
#{1 3}
My issue is iterating over the values in the hash map itself. I would specifically like to retrieve the n
th index from the hash map. Here is what I have tried
homework2.core> ((reg-ring-lattice 5 2) 3)
#{4 2}
homework2.core> (((reg-ring-lattice 5 2) 3) 0)
nil
homework2.core> (get ((reg-ring-lattice 5 2) 3) 0)
nil
I have searched but currently my knowledge of Clojure and its keywords/jargon is limited.
The first question is, am I calling these collections by their proper names. Second, how can I retrieve a value at a specified index in what I am calling a hashmap?