specter

2025-09-28T13:11:08.421889Z

Hi @nathanmarz Long story short: We found ourselves in a situation with a path that contains a terminal inside a if-path cond (please don't ask how 😅). We figured that terminal return NONE on select* causes the terminal to act as a false in the if-path cond. We created our own terminal which returns nil on select*. Can you see any ramifications for that? Or, can you tell us what the NONE in terminal was meant to accomplish?

2025-09-28T15:02:15.797319Z

@itai

nathanmarz 2025-09-30T14:34:23.233269Z

if you want that logic, then you can change your select* to call (next-fn structure)

2025-09-30T15:32:54.390559Z

What is the next-fn of the last navigator?

nathanmarz 2025-09-30T15:36:39.416879Z

that's determined by whether it's select, select-one, or select-any

2025-09-30T15:37:19.654189Z

[], nil, NONE?

nathanmarz 2025-09-30T15:37:36.877989Z

select accumulates navigated values into a volatile

nathanmarz 2025-09-30T15:38:19.478299Z

select-any / select-one rely on the return value of select*

nathanmarz 2025-09-30T15:38:32.997569Z

select-one just checks that it hasn't navigated to more than one place

nathanmarz 2025-09-29T20:22:51.901009Z

not sure what you're asking

nathanmarz 2025-09-29T20:22:55.021169Z

can you show the full path in question?

itaied 2025-09-30T02:18:13.565569Z

(sp/multi-transform (sp/if-path [:x (terminal-hack inc)]
                                [:x (terminal-hack inc)])
                    {:x 0}) ; => {:x 1}
(sp/multi-transform (sp/if-path [:x (sp/terminal inc)]
                                [:x (sp/terminal inc)])
                    {:x 0}) ; => {:x 0}
where
(sp/defrichnav
  ^{:doc "Defines an endpoint in the navigation the transform function run. The transform
          function works just like it does in `transform`, with collected values
          given as the first arguments"}
  terminal-hack
  [afn]
  (select* [this vals structure next-fn]
           nil) ; changed this value from NONE to nil
  (transform* [this vals structure next-fn]
              (i/terminal* afn vals structure)))

nathanmarz 2025-09-30T02:54:39.474719Z

the protocol of select* is to return NONE if it navigates nowhere

nathanmarz 2025-09-30T02:54:59.860779Z

or if everywhere it navigates navigates nowhere

nathanmarz 2025-09-30T02:55:06.515459Z

so that navigator definition breaks the protocol

nathanmarz 2025-09-30T02:55:18.323569Z

you just shouldn't have terminal inside if-path conditions

itaied 2025-09-30T05:59:14.506349Z

it is currently a part of our navigation system and we need to answer the question "does this path lead somewhere?" much like if-path works it's just that we compose terminals to it (partially to support promise chaining) alternatively, can we ask "does this path lead somewhere or is it a terminal?" instead?