[metapost] Modifying <parameter> name of a <binary def>

Andreas Matthias amat at kabsi.at
Sun Mar 23 21:04:51 CET 2008

tertiarydef lop __ rop =
  lop = rop

foo __ 4;
show foo;

This snippet is just a cumbersome way to say:

  foo = 4;

But actually I would like to give the variable name `foo'
a prefix, say `my_'. So that the above snippet expands to:

  my_foo = 4;

Is this possible?

I'm not looking for

  my_foo __ 4;

The prefix should just be added within the tertiarydef.

If you are curious to know, what I am doing: I'm trying to parse
a key-value list. And the above snippet is part of the
`processKeyvals_latexmp' macro from latexmp.mp. The names of keys
should be simple, but if they are too simple they might conflict
with variables defined by the user. That's why I would like to
give them a prefix.


More information about the metapost mailing list