R/MRatCalcpowered by RiX

RiX walkthrough 2 e

Nulls and holes

Undefined values, defaults, and coalescing.

Distinguish an unfilled slot from null

A hole means a missing value; it is distinct from the explicit null value _. Hole coalescing gives a fallback without treating every false-like value as absent.

An empty position inside an array is a hole. ?| supplies a value only for a hole. The first result below is 99, while an explicit _ stays _.

Runnable RiX

Do not confuse an unfilled existing slot with an out-of-range lookup: values[4] evaluates to _, so hole coalescing does not replace it. Compare the two yourself before relying on a default.

Use a fallback deliberately

Holes are useful in partially filled data, optional call arguments and soft matching. A fallback should mean “no value was supplied,” not “the supplied value looks false.” Capstone: bounds check applies that rule to a sensor reading.

Continue with Capstone: bounds check or return to Collections.