Open mahrud opened 1 week ago
Note that it's not so easy to use memoize
with say a method with options, as I think I pointed out in some other thread.
e.g., givin
f= method(Options=>new OptionTable from{a=>1})
neither
f ZZ := o -> memoize(x -> (print (x,o#a); x+o#a))
nor
f ZZ := memoize(o -> x -> (print (x,o#a); x+o#a))
will work, as can be checked by applying repeatedly. this does work:
f ZZ := memoize(o -> memoize(x -> (print (x,o#a); x+o#a)))
but seems heavy.
If one wants to ignore the option for memoize
purposes, I don't even know any simple option.
Should
memoize
be sensitive to options?I can see arguments both ways:
I don't think using
memoize
(as opposed to other means of caching) should be recommended anyway, so maybe this is a moot point.