Executing multiple steps to handle a purchase using currying
I take it here that you mean “algebra” to mean lambda calculus and by extension, combinatory logic.

The takeStep function is essentially (disregarding side-effects): $$
\lambda ab.b
$$ in lambda calculus, or in JS in terms of identity (using Haskell Curry’s combinator naming):

I = a =&gt; a
K = a =&gt; b =&gt; a
KI = K(I)


So as the takeStep function is simply disregarding the first argument, and the walk function calling the second argument with the previous (/initial) value there and then, I’m wondering if you would really be after the B-combinator $$
   \lambda fga.f(ga)
$$ (or, as JS: B = f =&gt; g =&gt; a =&gt; f(g(a)), often named compose) with possibly the C-combinator $$
   \lambda fab.fba
$$ (C = f =&gt; a =&gt; b =&gt; f(b)(a)) for reversing the arguments (often named pipe or sequence for f =&gt; g =&gt; a =&gt; g(f(a))).

(I’m not sure if the commutativity of the functions or JS evaluation strategy plays a role here.)

Regarding currying, I wonder if you were thinking of partial application instead.