RosettaCodeData/Task/Metaprogramming/SNOBOL4/metaprogramming-5.sno

9 lines
450 B
Plaintext

* 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