liveBook · Manning

Preorder traversal

Preorder traversal is a tree traversal strategy that processes each node before recursively processing its child subtrees.

How 2 Manning books explain it

Functional Programming in JavaScript

A tree traversal strategy that visits a node before recursively visiting its children.

How it is used
Uses recursive preorder traversal to transform every value while preserving the tree’s structure.
How deep it goes
Defines the visit order, illustrates recursive descent, and implements it through Tree.map.
Examples
Uses a mathematician hierarchy represented with Node objects and mapped to a preorder sequence of full names.
What you can do after
Apply it via recursive JavaScript functions that process or transform each tree node in preorder.

Read how Functional Programming in JavaScript explains preorder traversal →

Clojure: The Essential Reference

A pre-order traversal processes a node before recursively processing its children.

How it is used
Guides transformations and inspections of arbitrarily nested Clojure data before processing descendant values.
How deep it goes
Defines depth-first ordering, function timing, inputs, outputs, and exceptions, but defers implementation internals.
Examples
Uses nested vectors, prewalk-demo output, and a pipeline branch whose descendants should not execute.
What you can do after
Apply it via clojure.walk/prewalk to inspect or transform each nested value before descending into children.

Read how Clojure: The Essential Reference explains preorder traversal →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.