-- Lazy. -- (C) Dmitry Boulytchev, JetBrains Research, St. Petersburg State University, 2020 -- -- Deferred computations. public fun makeLazy (f) { var value, set = false; fun () { if set then value else var c; -- need this temporary since in value := f () value would -- create an intermediate managed pointer set := true; c := f (); value := c; c fi } } public fun force (f) { f () }