specter

Latest version: 1.1.3
2018-03-23T11:39:46.000008Z

Hello - noob question. I'm trying to use transform to reverse the values in a map:

(transform [ALL :average]
   reverse
            [{:average 0.14479934967087002}
             {:average 0.7736362292522883}
             {:average 0.6189089834018306}
             {:average 0.6188565442780262}])
but I get Don't know how to create ISeq from: java.lang.Double

nathanmarz 2018-03-23T12:23:46.000339Z

@poppetew that' because you're navigating to the individual values, so reverse is being applied to each of them

nathanmarz 2018-03-23T12:23:52.000486Z

the correct way to do that is:

(transform (subselect ALL :average)
   reverse
   [{:average 0.14479934967087002}
    {:average 0.7736362292522883}
    {:average 0.6189089834018306}
    {:average 0.6188565442780262}])

nathanmarz 2018-03-23T12:24:07.000180Z

subselect lets you manipulate an arbitrary selection as a sequence, with changes applied at the original locations

2018-03-23T12:44:28.000350Z

magic - thanks