diff options
author | Stavros Aronis <[email protected]> | 2015-11-25 13:22:26 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-01-28 14:57:13 +0100 |
commit | 4a413c8e8d5d9652c2beabfc7897c87092bd3427 (patch) | |
tree | ea32734ffa5a3eadc0f1b0b6c2e468ce6e371ee0 /erts/emulator/beam/beam_debug.c | |
parent | ef19115a637619d719ac96fdbd2262ca62fa8095 (diff) | |
download | otp-4a413c8e8d5d9652c2beabfc7897c87092bd3427.tar.gz otp-4a413c8e8d5d9652c2beabfc7897c87092bd3427.tar.bz2 otp-4a413c8e8d5d9652c2beabfc7897c87092bd3427.zip |
Extend cerl_trees:mapfold with a 'pre-order' operation
When manipulating Core Erlang trees it may be useful to perform some
operation when a node is visited, before inspecting children nodes. The
definition of cerl_tree:mapfold/3 does not allow that, as it applies the
given function only after all the recursive calls on the children nodes
have been completed.
This patch adds a new argument to mapfold: a function that is applied when
a node is first entered.
As an example of its use, consider the case where one wants to move a
'call' node earlier, by adding 'let' node and replacing the 'call' node
with the defined variable. The name of that variable must be specified
before one traverses the inner tree (especially if such replacements can be
nested).
Diffstat (limited to 'erts/emulator/beam/beam_debug.c')
0 files changed, 0 insertions, 0 deletions