Fork me on GitHub
#specter
<
2022-04-05
>
jose11:04:14

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}]

nathanmarz17:04:08

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

👍 1
nathanmarz17:04:16

has nothing to do with the navigated values themselves

nathanmarz17:04:35

STOP is "false" for paths

nathanmarz17:04:56

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