Hi Mikael,
Thanks.
Fabrice

Le mar. 11 févr. 2020 à 14:01, Mikael P. Sundqvist <mickep@gmail.com> a écrit :
On Tue, Feb 11, 2020 at 1:22 PM Fabrice Couvreur <fabrice1.couvreur@gmail.com> wrote:
Hi Hans,
I tried this but without success :

 \startMPcode
     suite{1,0};
     suite{2,1};
 \stopMPcode

Fabrice

Le mar. 11 févr. 2020 à 13:08, Hans Hagen <j.hagen@xs4all.nl> a écrit :
On 2/11/2020 11:50 AM, Fabrice Couvreur wrote:
> Hi,
> I have some problems with the following macro :
>
> tex error       > mp error on line 23 in file /home/viserion/macro.tex:
>
> ! Missing argument to suite.
> <to be read again>
> {
> <*> suite{
> 1,0}; suite(2,1); ;
> That macro has more parameters than you thought.
> I'll continue by pretending that each missing argument
> is either zero or null.
>
> ! Missing argument to suite.
> <to be read again>
> {
> <*> suite{
> 1,0}; suite(2,1); ;
> That macro has more parameters than you thought.
> I'll continue by pretending that each missing argument
> is either zero or null.


{} instead of ()

> ! Extra tokens will be flushed.
> <to be read again>
> {
> <*> suite{
> 1,0}; suite(2,1); ;
> I've just read as much of that statement as I could fathom,
> so a semicolon should have been next. It's very puzzling...
> but I'll try to get myself back together, by ignoring
> everything up to the next `;'. Please insert a semicolon
> now in front of anything that you don't want me to delete.
> (See Chapter 27 of The METAFONTbook for an example.)
>
> [1]
>
> 13       enddef;
> 14     \stopMPcode
> 15     \starttext
> 16      On présente ci-dessous deux suites de dessins.
> 17           \startlinecorrection[blank]
> 18             \startmidaligned
> 19               \startcombination[2*1]
> 20                 {\startMPcode
> 21                   suite{1,0};
> 22                   suite(2,1);
> 23 >>               \stopMPcode}{\tfxx \bf Suite 2}
> 24           \stopcombination
> 25             \stopmidaligned
> 26           \stoplinecorrection
> 27     \stoptext
>
> mtx-context     | fatal error: return code: 256
>
> TeX Output exited abnormally with code 1 at Tue Feb 11 11:45:53
>
> ##################################################
> macro.tex
> ##################################################
>
> \startMPcode
>    def suite (expr n, t) =
>    begingroup
>     numeric u;
>     u := 5mm;
>     pickup pencircle scaled 4pt;
>     for i=0 upto n:
>       for j=0 upto n:
>           drawdot (i*u,j*u) shifted(t*u,0) withcolor darkred;
>       endfor
>     endfor
>    endgroup
>    enddef;
> \stopMPcode
> \starttext
>   On présente ci-dessous deux suites de dessins.
>        \startlinecorrection[blank]
>          \startmidaligned
>            \startcombination[2*1]
>              {\startMPcode
>                suite{1,0};
>                suite(2,1);
>               \stopMPcode}{\tfxx \bf Suite 2}
>        \stopcombination
>          \stopmidaligned
>        \stoplinecorrection
> \stoptext
>
>
> Thank you.
> Fabrice
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>


--

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

I think Hans meant you should use () and not {}.

The following compiles here.

Hope it helps!

/Mikael

\startMPcode
  def suite (expr n, t) =
  begingroup
   numeric u;
   u := 5mm;
   pickup pencircle scaled 4pt;
   for i=0 upto n:
     for j=0 upto n:
         drawdot (i*u,j*u) shifted(t*u,0) withcolor darkred;
     endfor
   endfor
  endgroup
  enddef;
\stopMPcode
\starttext
 On présente ci-dessous deux suites de dessins.
      \startlinecorrection[blank]
        \startmidaligned
          \startcombination[2*1]
            {\startMPcode
              suite(1,0);
              suite(2,1);
             \stopMPcode}{\tfxx \bf Suite 2}
      \stopcombination
        \stopmidaligned
      \stoplinecorrection
\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________