Module adapton::macros
[−]
[src]
Macros to make using the engine
module's interface more
ergonomic.
Examples:
To memoize a function call to foo
, named by name
(of type
Name
) that receives two arguments, arg1
and arg2
, use the
following macro invocation:
let res = memo!( name =>> foo =>> x:arg1, y:arg2 ); ...
The same syntax works for creating (unforced) thunks, too:
let t = thunk!( name =>> foo =>> x:arg1, y:arg2 ); ...
The memo!
macro differs from thunk!
only in that it force
s
the thunk too (e.g., by doing force(&t)
, above, after creating
the thunk).
Structs
ProgPt |
Program points: used by the Adapton engine to distinguish different memoized functions. |
Functions
bump_name_counter |
Convenience function: A global counter for creating unique names, e.g., in unit tests. Avoid using this outside of unit tests. |