[metapost] Filling an array

Troy Henderson thenders at gmail.com
Mon Jun 18 18:40:34 CEST 2012


I would like to create a function that fills an array (that is passed to
the function).  I tried

def fillarray (expr x) =
   for n=1 upto 10:
      x[n]:=n;
   endfor;
enddef;

numeric x[];

but when I tried calling the function with

fillarray(x);

or with

fillarray(x[]);

I get error(s).  Can a function be defined in MetaPost to fill an array?

Thanks,

Troy Henderson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/metapost/attachments/20120618/19e4bd47/attachment.html>


More information about the metapost mailing list