Skip to content

Instantly share code, notes, and snippets.

@sogaiu
Last active July 23, 2025 04:35
Show Gist options
  • Save sogaiu/850f3842e2a088f79e63ecf55add6fb2 to your computer and use it in GitHub Desktop.
Save sogaiu/850f3842e2a088f79e63ecf55add6fb2 to your computer and use it in GitHub Desktop.
users of walk, postwalk, or prewalk

can fetch by git-some-janets: https://github.com/sogaiu/git-some-janets

git-some-janets junk-drawer 
git-some-janets hm
git-some-janets janet-unify
git-some-janets bauble
git-some-janets judge
git-some-janets macaroni
git-some-janets pat
git-some-janets square
git-some-janets spork
git-some-janets read-write-http
git-some-janets janet-playground

to see some uses (includes extra stuff too):

rg -M 100 -g *.janet --sort=path walk

output edited to remove some "false" hits:

repos/github.com/AlecTroemel/junk-drawer/junk-drawer/tweens.janet
94:  ((fn f [y] (walk f y)) x))

repos/github.com/andrewchambers/hm/infer.janet
172:      (def new-t (prewalk |(get solved-types $ $) t))

repos/github.com/andrewchambers/hm/unify.janet
97:  (prewalk f form))

repos/github.com/andrewchambers/janet-unify/unify.janet
93:  (prewalk f form))

repos/github.com/ianthehenry/bauble/src/cubert/util.janet
15:      (prewalk |(if (= $ sym) i $) body))])

repos/github.com/ianthehenry/bauble/src/jlsl/adt.janet
132:(defn- ungensym [structure] (prewalk |(if (gensymy? $) '<> $) structure))

repos/github.com/ianthehenry/bauble/src/jlsl/render.janet
289:        (walk visit node))
294:        (walk visit (impl :declared-return-type))
295:        (walk visit (impl :params))
296:        (walk visit (impl :body)))
297:      (walk visit node)))
298:  (walk visit root-variables)
299:  (walk visit main)

repos/github.com/ianthehenry/bauble/src/lib/evaluator.janet
43:        ,(jlsl/@function/custom impl) (walk visit (impl :body))
44:        (walk visit node))))
45:  (walk visit expr)

repos/github.com/ianthehenry/bauble/src/lib/syntax/dot-syntax.janet
4:(def expand (partial prewalk (fn [ast]

repos/github.com/ianthehenry/bauble/src/lib/syntax/infix-syntax.janet
15:  (prewalk (fn [ast]
80:  (test-stdout (prewalk (fn [ast] (when (tuple? ast) (pp (tuple/sourcemap ast))) ast) form) `
84:[Omitted long line with 1 matches]
91:  (test-stdout (prewalk (fn [ast] (when (tuple? ast) (pp (tuple/sourcemap ast))) ast) form) `
95:[Omitted long line with 1 matches]
104:  (test-stdout (prewalk (fn [ast] (when (tuple? ast) (pp (tuple/sourcemap ast))) ast) form) `
108:[Omitted long line with 1 matches]

repos/github.com/ianthehenry/bauble/src/lib/syntax/pipe-syntax.janet
8:(def- unshort-fn (partial prewalk (fn [ast]
19:  (prewalk (fn [ast]
105:  (test-stdout (prewalk (fn [ast] (when (tuple? ast) (pp (tuple/sourcemap ast))) ast) form) `
111:[Omitted long line with 1 matches]
119:  (test-stdout (prewalk (fn [ast] (when (tuple? ast) (pp (tuple/sourcemap ast))) ast) form) `
129:[Omitted long line with 1 matches]

repos/github.com/ianthehenry/bauble/src/util/init.janet
50:# This is a bit like postwalk, except that it works
64:(def- core/walk walk)
65:(defn visit [structure f &opt walk]
66:  (default walk core/walk)
77:      (walk recur node)
85:(test-stdout (do (postwalk (fn [x] (pp x) x) [1 1 1]) nil) `

repos/github.com/ianthehenry/bauble.studio/src/cubert/util.janet
15:      (prewalk |(if (= $ sym) i $) body))])

repos/github.com/ianthehenry/bauble.studio/src/jlsl/adt.janet
132:(defn- ungensym [structure] (prewalk |(if (gensymy? $) '<> $) structure))

repos/github.com/ianthehenry/bauble.studio/src/jlsl/render.janet
289:        (walk visit node))
294:        (walk visit (impl :declared-return-type))
295:        (walk visit (impl :params))
296:        (walk visit (impl :body)))
297:      (walk visit node)))
298:  (walk visit root-variables)
299:  (walk visit main)

repos/github.com/ianthehenry/bauble.studio/src/lib/evaluator.janet
43:        ,(jlsl/@function/custom impl) (walk visit (impl :body))
44:        (walk visit node))))
45:  (walk visit expr)

repos/github.com/ianthehenry/bauble.studio/src/lib/syntax/dot-syntax.janet
4:(def expand (partial prewalk (fn [ast]

repos/github.com/ianthehenry/bauble.studio/src/lib/syntax/infix-syntax.janet
15:  (prewalk (fn [ast]
80:  (test-stdout (prewalk (fn [ast] (when (tuple? ast) (pp (tuple/sourcemap ast))) ast) form) `
84:[Omitted long line with 1 matches]
91:  (test-stdout (prewalk (fn [ast] (when (tuple? ast) (pp (tuple/sourcemap ast))) ast) form) `
95:[Omitted long line with 1 matches]
104:  (test-stdout (prewalk (fn [ast] (when (tuple? ast) (pp (tuple/sourcemap ast))) ast) form) `
108:[Omitted long line with 1 matches]

repos/github.com/ianthehenry/bauble.studio/src/lib/syntax/pipe-syntax.janet
8:(def- unshort-fn (partial prewalk (fn [ast]
19:  (prewalk (fn [ast]
105:  (test-stdout (prewalk (fn [ast] (when (tuple? ast) (pp (tuple/sourcemap ast))) ast) form) `
111:[Omitted long line with 1 matches]
119:  (test-stdout (prewalk (fn [ast] (when (tuple? ast) (pp (tuple/sourcemap ast))) ast) form) `
129:[Omitted long line with 1 matches]

repos/github.com/ianthehenry/bauble.studio/src/util/init.janet
50:# This is a bit like postwalk, except that it works
64:(def- core/walk walk)
65:(defn visit [structure f &opt walk]
66:  (default walk core/walk)
77:      (walk recur node)
85:(test-stdout (do (postwalk (fn [x] (pp x) x) [1 1 1]) nil) `

repos/github.com/ianthehenry/judge/src/init.janet
135:    :table (witness seen x (square-keys (walk stably-clone x)))
136:    :struct (square-keys (walk stably-clone x))
137:    :array (witness seen x (walk stably-clone x))
138:    :tuple (walk stably-clone x)

repos/github.com/ianthehenry/judge/src/util.janet
56:  (prewalk (fn [node]

repos/github.com/ianthehenry/macaroni/src/init.janet
52:      (walk expand form))))

repos/github.com/ianthehenry/pat/src/init.janet
151:  (prewalk (fn [x]

repos/github.com/ianthehenry/square/src/init.janet
4:(use ./walkies)
16:  (catwalk (fn [spliceable form]
26:  (postwalk |(if (= $ pipe) "|" $)
56:  (postwalk split-squares

repos/github.com/ianthehenry/toodle.studio/src/dot-syntax.janet
1:(use ./walkies)
13:  (prewalk |(if (symbol? $) (expand-dots $) $) form))

repos/github.com/ianthehenry/toodle.studio/src/walkies.janet
7:(defn- walk-ind [f form]
12:(defn- walk-dict [f form]
18:(defn walk
25:    :table (walk-dict f form)
26:    :struct (table/to-struct (walk-dict f form))
27:    :array (walk-ind f form)
28:    :tuple (let [x (walk-ind f form)]
35:(defn postwalk
39:  (f (walk (fn [x] (postwalk f x)) form)))
41:(defn prewalk
42:  "Similar to `postwalk`, but do pre-order traversal."
44:  (walk (fn [x] (prewalk f x)) (f form)))

repos/github.com/janet-lang/spork/spork/data.janet
67:    @[nil nil (postwalk |(cond (tuple? $) (array ;$)

repos/github.com/m7andrew/read-write-http/http/read.janet
46:  (postwalk (fn [x] (if (array? x) (table ;x) x)) arr))

repos/github.com/pepe/janet-playground/playground/examples.janet
106:(defn walker
107:  `Simple walker function, that prints non-sequential
108:   members of the form and walks recursively sequential
113:      (walk walker form))
116:(walk walker [[[[0 1 3]] 16 7 [3 [3 5]] 3 4] 1 [3 4]])

repos/github.com/pepe/janet-playground/playground/numbers-walking.janet
1:(defn walker [f &opt level]
5:      (walk (walker f (f level)) form)
8:(walk (walker dec 10) [[[[0 1 3]] 10 7 [3 [3 5]] 3 4] 1 [3 4]])
9:(walk (walker inc) [[[[0 1 3]] 16 7 [3 [3 5]] 3 4] 1 [3 4]])

specific files with hits that end up under repos

github.com/AlecTroemel/junk-drawer/junk-drawer/tweens.janet
github.com/andrewchambers/hm/infer.janet
github.com/andrewchambers/hm/unify.janet
github.com/andrewchambers/janet-unify/unify.janet
github.com/ianthehenry/bauble/src/cubert/util.janet
github.com/ianthehenry/bauble/src/jlsl/adt.janet
github.com/ianthehenry/bauble/src/jlsl/render.janet
github.com/ianthehenry/bauble/src/lib/evaluator.janet
github.com/ianthehenry/bauble/src/lib/syntax/dot-syntax.janet
github.com/ianthehenry/bauble.studio/src/cubert/util.janet
github.com/ianthehenry/bauble.studio/src/jlsl/adt.janet
github.com/ianthehenry/bauble.studio/src/jlsl/render.janet
github.com/ianthehenry/bauble.studio/src/lib/evaluator.janet
github.com/ianthehenry/bauble.studio/src/lib/syntax/dot-syntax.janet
github.com/ianthehenry/bauble.studio/src/lib/syntax/infix-syntax.janet
github.com/ianthehenry/bauble.studio/src/lib/syntax/pipe-syntax.janet
github.com/ianthehenry/judge/src/init.janet
github.com/ianthehenry/macaroni/src/init.janet
github.com/ianthehenry/pat/src/init.janet
github.com/ianthehenry/square/src/init.janet
github.com/janet-lang/spork/spork/data.janet
github.com/m7andrew/read-write-http/http/read.janet
github.com/pepe/janet-playground/playground/examples.janet
github.com/pepe/janet-playground/playground/numbers-walking.janet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment