-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
(not important right now, but to keep in mind)
In some cases, caching is really important, e.g., the LPO relation should only be computed once for each pair of subterms. While abstract evaluation does this nicely, concrete evaluation does not, and this could be a problem when verifying a solution, using concrete evaluation. So far, I have not seen any examples where this hurts, but it could.
Perhaps this helps: http://hackage.haskell.org/package/memoize
Note however that it requires some rewrite of the code (to make the use of the fixpoint operator explicit), like
lpo prec = memoFix2 $ \ f s t -> ... f ( s !! i ) ( t !! j ) ...
This could be done by the programmer or by a TH preprocessor. If programmer does it:
- source code looks more ugly
- can import Standalone.hs as it is (e.g., for testing)
- memoFixN needs to be ignored by the CO4 compiler (or it could use caching exactly for those functions that are explicitly memoized)