[metapost] variable parameter list

Dan Luecking luecking at uark.edu
Wed Feb 15 20:03:58 CET 2006


At 05:13 PM 2/14/2006, you wrote:
>Dan Luecking wrote:
> > The fact that its return value is never used
> > suggests that it needn't actually have a return value. A for-loop
> > doesn't care if the expressions are empty, it just skips to the
> > next. I didn't test this, however.
>
>without return value:
>
>numeric b ; color c ;
>
>def processKeyvals (text _kvps_)=
>   begingroup;
>     save _equals, _assign ;
>     let _equals= = ;
>
>     primarydef _ll_ _assign _rr_ =
>       hide(_ll_ _equals _rr_ )
>     enddef;

This works, however:
    primarydef _ll_ _assign _rr_ =
       begingroup _ll_ _equals _rr_ ; endgroup
    enddef;
So does this:
    primarydef _ll_ _assign _rr_ =
       hide (_ll_ _equals _rr_ )begingroup endgroup
    enddef;

In the working versions, an empty group is returned, which apparently
is accepted as permitting the loop to proceed.

The hide command creates the group, but discards it. I thought
this might be treated the same as an absent element
(e.g., "b=5,,c=red") which is accepted, but apparently MP has
entered a state where it expects a secondary expression to
result from "b _assign 5" when it encounters the following
comma without finding one.


Dan


Daniel H. Luecking
Department of Mathematical Sciences
University of Arkansas
"Be kind. Every person you meet is fighting a hard battle." - Anon.



More information about the metapost mailing list