Rank Polymorphism
Rank polymorphism gives you code reuse on arguments of different dimensions. Take a linear interpolation function (let’s just call it lerp
) for scalars:
(λ ((lo 0) (hi 0) (α 0)) (+ (* lo ( 1 α)) (* hi α)))
The number marks on each argument indicate the expected “rank” of the argument: how many dimensions it should have. In this case, each one is marked 0
, indicating a scalar (i.e., 0dimensional) argument. The function is usable asis for

αblending two RGB pixels

dimming or brightening an image

fade transition between video scenes