specter

jose 2022-04-05T11:31:14.893309Z

I'm a bit confused by the if-path cond-path semantics, looks like navigates to the path if the condition is not false (and considers nil a truthy value) is that correct? An example:

(s/select (s/if-path [:a]
            :a
            s/STAY)
          {:b 2})
;; => [nil]

(s/select (s/if-path (comp boolean :a)
            :a
            s/STAY)
          {:b 2})
;; => [{:b 2}]

nathanmarz 2022-04-05T17:55:08.098999Z

@jlle conditions in specter paths are based on whether the path navigates to anything or not

👍 1
nathanmarz 2022-04-05T17:55:16.811409Z

has nothing to do with the navigated values themselves

nathanmarz 2022-04-05T17:55:35.472139Z

STOP is "false" for paths

nathanmarz 2022-04-05T17:55:56.970809Z

keypath always navigates, so it's always considered "true"