-
-
Save anonymous/b840211c8ce0088d79da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have this data: | |
[[[1 1] 300000] [[2 2] 150000] [[3 3] 120000] [[4 4] 100000] [[5 5] 80000] [[6 6] 70000] [[7 9] 60000]] | |
When going through each element, I want to do this: | |
In [[1 1] 30000], I want to output a vector of [1 30000] because [1 1] is a range that corresponds to 1 | |
In [[7 9] 60000], I want to output vectors of [7 60000], [8 60000], and [9 60000] | |
I should wind up with: | |
[[1 300000] [2 150000] [3 120000] [4 100000] [5 80000] [6 70000] [7 60000] [8 60000] [9 60000]] | |
I tried this function: | |
(fn [item] | |
(let [[[x y] z] item] | |
(map #(vec [% z]) | |
(range x (+ y 1))))) | |
But it's confusing, and yielded this | |
(([1 300000]) ([2 150000]) ([3 120000]) ([4 100000]) ([5 80000]) ([6 70000]) ([7 60000] [8 60000] [9 60000])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment