[metapost] accessing variables in nested macros

Stephan Hennig mailing_list at arcor.de
Sun Feb 11 12:26:37 CET 2007


Mojca Miklavec schrieb:

> def init=
>  b := a + 1;
> enddef;
> 
> def calcA(expr aa)=
> save a; numeric a; a := aa;
> save b; numeric b;
>  init;
>  show "a = " & decimal a;
>  show "b = " & decimal b;
> enddef;


That is the other solution.  But from Piotr's response I understand that
parametrizing "init" is the cheaper solution---from MetaPost's point of
view---since it doesn't introduce additional variables.  I may be wrong
with that.

Best regards,
Stephan Hennig


More information about the metapost mailing list