Hi,
Thanks for your help. I did several tests playing only with the code of component 5 which interferes with that of component 14.

@Aditya
begingroup;
.....
endgroup;
does not work.

@Hans
save defaultfont, defaultscale;

maybe also:

save circle, p, q, b ;

I get an empty rectangle in place of the graph in composant 5.

@Taco
The solution that works is to add component 14 to the code

numeric a, b;

Fabrice


Le ven. 26 avr. 2024 à 10:45, Aditya Mahajan <adityam@umich.edu> a écrit :
On Fri, 26 Apr 2024, Taco Hoekwater wrote:

>
>
> > On 25 Apr 2024, at 23:12, Fabrice Couvreur <fabrice1.couvreur@gmail.com> wrote:
> >
> > Hi,
> > Here is the code that interferes with the graph from the last chapter but why ?
>
> Because of this “path b”:
>       
> >              path circle, p, q, b;
>
> which interferes with the assignment line from the other graphic code:
>
> >              b := xpart(reverse C_f intersectionpoint reverse C_g);
>
> because there “b” is a now a path, not a numeric.
>
> Adding
>
>    numeric a,b;
>
> fixes the problem in chapter 14.

Woundn't newnumeric be better?

There are very few instances where I want variables defined in one block to be reused in another block. So, I almost always use

\startMPcode
begingroup;
....
endgroup;
\stopMPcode

to avoid such issues.

Aditya___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________