## Features & Development

### contextAlternateIntervals.pl error with infinite endpoint

by Jonathan Desaulniers -
Number of replies: 3

Hello!

I'm trying to use the contextAlternateIntervals.pl macro but there seem to be a problem with interval of the type:

]-inf, b[ or ]a, inf[

In fact, when trying to use the flag enterIntervals => "alternate", it's not possible to use any infinite endpoint.

The display seem fine, trouble is only on the interval input. Any idea of a workaround? This would be very helpful.

thanks

Jonathan Desaulniers

### Re: contextAlternateIntervals.pl error with infinite endpoint

by Danny Glin -

Can you post a working example of what you are seeing?

### Re: contextAlternateIntervals.pl error with infinite endpoint

by Jonathan Desaulniers -

Here is the code for the problem. I took of the graphic and text from the exmple since it's not important.

DOCUMENT();

"PGstandard.pl",

"MathObjects.pl",

"PGcourse.pl",

"PGgraphmacros.pl",

"unionTables.pl",

"contextAlternateIntervals.pl",

);

TEXT(beginproblem());

Context("AlternateIntervals");

Context()->flags->set(

enterIntervals => "alternate",

displayIntervals => "alternate",

);

#Context("Interval");

$a=random(-10,10);$choix=random(0,1);

if ($choix == 0) {$reponse = Interval("]$a,inf["); } else {$reponse= Interval("[$a,inf["); } ANS(($reponse)->cmp);

and here is the error:

        Problem1
1. ERROR caught by Translator while processing problem file:tmpEdit/local/jonathan/MaNTS5/Notions_base/Intervalles/TESTInterDroite1.pg.jdesaulniers.tmp
****************
ERRORS from evaluating PG file:  Infinite endpoints must be open at line 369 of [TMPL]/local/jonathan/MaNTS5/Notions_base/Intervalles/contextAlternateIntervals.pl
Died within context::AlternateIntervals::Parser::Interval::_check called at line 57 of [PG]/lib/Parser/List.pm
from within Parser::List::new called at line 343 of [TMPL]/local/jonathan/MaNTS5/Notions_base/Intervalles/contextAlternateIntervals.pl
from within context::AlternateIntervals::Parser::List::new called at line 268 of [TMPL]/local/jonathan/MaNTS5/Notions_base/Intervalles/contextAlternateIntervals.pl
from within context::AlternateIntervals::Formula::Close called at line 218 of [TMPL]/local/jonathan/MaNTS5/Notions_base/Intervalles/contextAlternateIntervals.pl
from within context::AlternateIntervals::Formula::Open called at line 139 of [PG]/lib/Parser.pm
from within Parser::parse called at line 50 of [PG]/lib/Parser.pm
from within Parser::new called at line 19 of [PG]/lib/Value/Formula.pm
from within Value::Formula::new called at line 401 of [PG]/lib/Value.pm
from within Value::makeValue called at line 20 of [PG]/lib/Value/Interval.pm
from within Value::Interval::new called at line 291 of [TMPL]/local/jonathan/MaNTS5/Notions_base/Intervalles/contextAlternateIntervals.pl
from within context::AlternateIntervals::Interval::new called at line 74 of [PG]/macros/Value.pl
from within main::Interval called at line 42 of (eval 1732)
Jonathan Desaulniers