liveBook · Manning

Fork combinator

As explained in Functional Programming in JavaScript

A combinator that sends one input through two functions and combines their results with a third function.

The fork combinator sends one input through two functions, then combines both results with a third function. It helps replace branching or repeated calculations with one reusable control step. section 4.6

It is a higher-order control combinator: it orchestrates flow without declaring its own business logic. The pattern is useful when one value must be analyzed in two ways before producing a final result. section 4.6

Average grade

One example computes a letter grade by sending a list to sum and length, then dividing the two results. Another compares median and mean for equality.

How Functional Programming in JavaScript covers it

How deep it goes
Defines the pattern and shows its function shape, but stops short of deeper theory or internal mechanics.
Examples
Uses average grade and median-versus-mean comparisons as concrete forked computations.
What it assumes
Assumes basic familiarity with functions and composition, while explaining combinators from a plain-language control-flow need.
What you can do after
Apply it to build reusable two-branch calculations with a final combined result.
How it connects
Connects to compose, higher-order functions, and other function combinators.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Functional Programming in JavaScript. The section links point to the parts of the book it draws on.