RosettaCodeData/Task/Metaprogramming/SNOBOL4/metaprogramming-5.sno
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

8 lines
450 B
Text

* This example provides a bizarrely-expensive addition operation.
* It assumes the existence of an expensive procedure—say a database
* lookup—to extract the value to be added. This version uses the
* typical initialize-on-definition approach to implementation.
DEFINE('XADD(X)','XADD')
ADDVALUE = CALL_SOME_EXPENSIVE_OPERATION() :(XADD.END)
XADD XADD = X + ADDVALUE :(RETURN)
XADD.END