Fork me on GitHub
#specter
<
2018-03-23
>
Peter Wilkins11:03:46

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

nathanmarz12:03:46

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

nathanmarz12:03:52

the correct way to do that is:

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

nathanmarz12:03:07

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

Peter Wilkins12:03:28

magic - thanks