CodeStory.Fold (CodeStory v0.1.0)

Copy Markdown View Source

Collapses consecutive sibling runs of the same {module, function, arity} in a call tree.

A run of N ≥ 2 identical subtrees (deep ===) folds losslessly to one node with count: N. A run that shares a function/arity but differs folds to the richest occurrence (most direct child calls, counted before those children are folded) with count: N, varies: true — a lossy summary that keeps the shape of one real call. Runs of 1 are untouched (no keys added), so a tree with no repetition is unchanged.

Summary

Functions

Folds consecutive identical / same-function sibling runs, bottom-up.

Types

node_map()

@type node_map() :: %{
  :module => module(),
  :function => atom(),
  :args => list(),
  :return => any(),
  :children => [node_map()],
  optional(:count) => pos_integer(),
  optional(:varies) => true
}

Functions

fold(nodes)

@spec fold([node_map()]) :: [node_map()]

Folds consecutive identical / same-function sibling runs, bottom-up.