Skip to content

feat: implement walk-reduce with secondary collections in tandem - #1

Merged
k13gomez merged 1 commit into
mainfrom
walk-tandem
Jul 7, 2026
Merged

k13gomez merged 1 commit into
mainfrom
walk-tandem

Conversation

@k13gomez

@k13gomez k13gomez commented Jul 7, 2026

Copy link
Copy Markdown
Member

walk-reduce, postwalk-reduce, and prewalk-reduce now accept any number of optional trailing secondary collections that are walked alongside the primary collection (paired by key for maps/records, by value/membership for sets, by index for vectors/lists/seqs) and passed as extra read-only arguments to the walk function, while remaining fully backward compatible with existing single-collection calls.

@k13gomez

k13gomez commented Jul 7, 2026

Copy link
Copy Markdown
Member Author
(w/postwalk-reduce
 (fn [match? a b]
   (if (and (fn? a)
            (not (fn? b)))
     [false ::did-not-match]
     [match? a]))
 true
 {:foo 1
  :bar {:baz odd?
        :quux {:quuux 3}}}
 {:foo 1
  :bar {:baz 2
        :quux {:quuux 3}}})
=>
[false
 {:foo 1
  :bar {:baz ::did-not-match
        :quux {:quuux 3}}}]

@k13gomez
k13gomez merged commit b1e011d into main Jul 7, 2026
7 checks passed
@k13gomez
k13gomez deleted the walk-tandem branch July 7, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants