Question: what is the point of adding UNTIL keyword to Maple?

(ps. there is no Maple 2018 product to select, so I selected Maple 2017 from the menu).

The new UNTIL keyword added to Maple 2018 seems to me to be confusing and a useless addition to the Maple language.

First of all, using it in a DO loop, one does not use an closing END DO as normal. This makes it harder to use, since one is used to seeing an END DO to close each DO. They align physically better, which makes the code easier to read.

In addition, I can't think of anything that can't be done using current language constructs that needs this new keyword. Can someone? 

Adding a whole new keyword to make one type maybe few less characters seems like  a bad language design. A language constructs should be orthogonal to each others for the language to remain simple and clean. Adding more keywords for the fun of it should be avoided if something can be written using exisiting language constructs.

n := 37:
do
  n := n + 1
until isprime(n);
n;

very confusing to read. It has no end do. At first, I did not see where the loop ends. And the above can be done in many other ways allready, one direct way could be

n := 37:
do
  n := n + 1;
  if isprime(n) then
     break;
  fi;
od;
n;

And it is more clear as well since the DO is aligned with the END DO and I find the logic clearer with no new keyword added. Another way could be

n:= 37:
found_prime := false:
while not found_prime do
   n:= n + 1;
   found_prime := isprime(n);
od:
n;

I am sure there are other ways to do this.

Could someone please show an example where UNTIL is really needed and will make the code much more clear that justifies adding it to the language?

 

 

Please Wait...