generatef {lazy.accel} | R Documentation |
Generation of functions which shares the same storage space
generatef(size = 3, times = 10)
size |
The size of the storage space. |
times |
The values to be multiplied. |
generatef function generates two functions: f1 and f2.
f1(loc,value) adds value to store1[loc] and adds times*value to store2[loc].
f2(loc,value) subtracts value from store1[loc] and subtracts times*value from store2[loc].
f1 and f2 share the storage store1 and store2.
f1 and f2 are retuned as a named list. Therefore, the actual functions, say ff1 and ff2, to be used can be created as follows:
funcs=generatef( size=3, times=10 ) ff1=funcs$f1 ff2=funcs$f2