specter

Samuel Ludwig 2023-10-20T20:42:20.461399Z

New to Specter, trying out a couple practice scenarios to get into it, so still pretty unfamiliar with the core concepts. One of the scenarios is "select/transform vals in a map whose keys are in namespace x", and it's giving me some trouble My current solution is incorrect (erroring, and is probably logically incorrect as well), but i feel like its probably something like this:

(sp/select 
  [(sp/filterer [MAP-KEYS NAMESPACE (sp/pred= "x")]) MAP-VALS] 
  {:x/one 1 :x/two 2 :y/three 3 :y/four 4})
where i want to access the 1 and 2 pointers from the more experienced would be much appreciated 😄

nathanmarz 2023-10-20T20:49:17.416039Z

@sludwig.dev this is how you do that:

(select 
  [ALL (selected? FIRST NAMESPACE (pred= "x")) LAST] 
  {:x/one 1 :x/two 2 :y/three 3 :y/four 4})

Samuel Ludwig 2023-10-20T20:50:26.653459Z

ohhhh the FIRST in this case it grabbing the map-key as if it were vector-pairs i see, i appreciate it!