I have a hashmap of data with the key a string description and value an integer weight.
{:a 2 :b 3 ......}
I need to transform the hash into a vector of vectors. Each internal vector contains the map entries.
[[[:a 2][:b 3]...][......]]
each internal vector is built based upon some rules. Ex the sum of all weights should not exceed a certain value
Normally this seems to be a good case for a reduce where a hash is transformed into a vector of vectors of map entries. However I may need to iterate over the hash more than once as I may need to reshuffle the entries between the internal vectors so that all of the vectors sum up to a certain num.
Any suggestions on how the problem should me modelled?