basilisp.walk
Generic data structure walkers.
Support for all builtin data structures and types is included by default. Users
can add support for custom data types by extending the IWalkable
protocol.
- protocolIWalkable
- fn (walk* this inner outer)
Walk the data structure applying inner to each element of the data structure, if any, and then applying outer to the result.
- fn (keywordize-keys form)
Recursively walk
form
, transforming string keys into keywords in any maps.
- fn (macroexpand-all form)
Recursively macroexpand all eligible forms contained in
form
.
- fn (postwalk f form)
Walk
form
using depth-first, post-order traversal, applyingf
to each form and replacingform
with its result.All built in data structures are supported.
Lazy sequences will be completely consumed (and thus may not be infinite).
- fn (postwalk-demo form)
Print each element as it is walked as by :lpy:fn`postwalk`.
- fn (postwalk-replace replacements form)
Recursively walk through
form
as bypostwalk
, replacing elements appearing as keys in the mapreplacements
with the corresponding values.
- fn (prewalk f form)
Walk
form
using depth-first, pre-order traversal, applyingf
to each form and replacingform
with its result.All built in data structures are supported.
Lazy sequences will be completely consumed (and thus may not be infinite).
- fn (prewalk-demo form)
Print each element as it is walked as by :lpy:fn`postwalk`.
- fn (prewalk-replace replacements form)
Recursively walk through
form
as byprewalk
, replacing elements appearing as keys in the mapreplacements
with the corresponding values.
- fn (stringify-keys form)
Recursively walk
form
, transforming keyword keys into strings in any maps.
- fn (walk inner outer form)
Walk an arbitrary, possibly nested data structure, applying
inner
to each element ofform
and then applyingouter
to the resulting form.All built in data structures are supported.
Lazy sequences will be completely consumed (and thus may not be infinite).