I'm trying to take some inputs, run a calculation on it, and then find the min, and get the parameters that created that min.
alist = [1 2 3 4 5 -4]
; I want [[1 -1] [2 -2] [3 -3]]
; the following doesn't work. how can i make it work?
(map #( [% (* -1 %)]) [ 1 2 3])
It can be a hashmap too, to store the results.
This should be absurdly trivial but I can't get it to work. Also my list is a lazy-seq so I couldn't just zip the results with the original list.
; this doesn't work cause alist is a lazy-seq in my program
(let [results (map #(* -1 %) alist)]
(map vector alist results)
)
[[1 -1] [2 -2] [3 -3]]?