Creates a new Scope with mapped values.
Ids start at 0 and increment monotonically, so all ids the scope hands out are pairwise
distinct; each is passed through mapper to produce the value returned. mapper runs once per id
and its result is cached, so a repeat keyed lookup returns the same value (the same reference when
mapper produces objects) without re-invoking it.
The mapped value type
Maps each monotonic id to the value handed out by the scope; invoked once per id
A fresh, immutable scope handing out mapped values
Creates a new Scope, optionally mapping each allocated id.