next | previous | forward | backward | up | top | index | toc | home

stashValue -- stash values of functions in their arguments

Synopsis

Description

i1 : x = new MutableHashTable from { val => 1000 }

o1 = MutableHashTable{...1...}

o1 : MutableHashTable
i2 : f = (t -> (print "hi there"; t.val^4))

o2 = f

o2 : FunctionClosure
i3 : h = (stashValue VALUE) f

o3 = h

o3 : FunctionClosure
i4 : h x
hi there

o4 = 1000000000000
i5 : h x

o5 = 1000000000000
i6 : peek x

o6 = MutableHashTable{val => 1000           }
                      VALUE => 1000000000000

See also

Code

-- ../../../../Macaulay2/m2/methods.m2:452
stashValue = key -> f -> x -> if x#?key then x#key else x#key = f x