Basic usage
Input
f = make_factory(5); adder = f.create(3); adder(10)
Output
18
adder(10) computes 10 + 3 + base(5) = 18.
Full lesson preview
Create a factory that produces configurable inner functions which share and can update a common enclosed state.
Problem statement
Task
Examples
Input
f = make_factory(5); adder = f.create(3); adder(10)
Output
18
adder(10) computes 10 + 3 + base(5) = 18.
Input format
Output format
Constraints
Samples
Input
make_factory(0).create(2)(4)
Output
6
4 + 2 + base(0) = 6