Pref::noProcRemTab
--
disable ``remember'' tablesPref::noProcRemTab(
TRUE)
disables the
``remember'' tables.
Pref::noProcRemTab( <value>)
value |
- | TRUE , FALSE , or NIL |
the last defined value
Without the ``remember'' tables the computation of any functions will be very much slower. The results are the same.
Pref::noProcRemTab(
TRUE)
the
``remember'' tables of procedures can be disabled.
Pref::noProcRemTab(
FALSE)
enables the
``remember'' tables.remember
of procedures results of
calculations will be kept and ``recycled'': If a function will be
called with the same arguments once again the previously calculated
result will be returned immediately.Pref::noProcRemTab
without arguments returns
the current value. The argument NIL
resets the default
value, which is FALSE
.Because of the unclever definition, the function
fac
(factorial function) will be called permamently with
the same arguments, and thats very often. The option
remember
corrects this, as a previous calculated result
will be returned immediately without a new call of the function
fac
.
>> reset(): fac:= proc(n = 1) option remember; begin if n > 2 then fac(n - 1)*fac(n - 2) else n end_if end_proc: time(fac(28))
890
Without this ``remember'' mechanism the effect of the
unclever definition will be gigantic, even on a very hurry computer.
Don't try fac(32)
.
>> reset(): Pref::noProcRemTab(TRUE): time(fac(28))
13600