Project

General

Profile

Design #1391

RingElems: syntax with [ and ] ?

Added by John Abbott over 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Category:
Improving
Target version:
Start date:
10 Jan 2020
Due date:
% Done:

100%

Estimated time:
5.77 h
Spent time:

Description

I was a little surprised that RingElems(P, "[x,y]") produced a run-time error.

Would it make sense to allow an initial "[" and a final "]"? Not sure...

2020-02: new function RingElemList


Related issues

Related to CoCoALib - Feature #1332: New function: vector of RingElem from string -- in CoCoALibClosed2019-10-08

Related to CoCoA-5 - Feature #1243: New function: Read a string into a list (of RingElem) -- CoCoA-5Closed2019-02-13

Related to CoCoA-5 - Feature #1509: RingElems with empty inputClosed2020-10-14

History

#1 Updated by John Abbott over 4 years ago

  • Related to Feature #1332: New function: vector of RingElem from string -- in CoCoALib added

#2 Updated by Anna Maria Bigatti over 4 years ago

  • % Done changed from 0 to 10

It is compatible with NewPolyRing(QQ, "x,y,z").

I prefer not to add the brackets because then we have to make the code more complicated, but I see your point....

On the other hand I see the RingElems( ) like square brackets.

#3 Updated by John Abbott over 4 years ago

  • Status changed from New to In Progress

Could it make sense to have a "variant" fn which accepts [ and ]?
Maybe RingElemVec or RingElemList?

#4 Updated by Anna Maria Bigatti over 4 years ago

  • % Done changed from 10 to 40

We could have a RingElemList in CoCoA-5.
I have defined a function in NotBuiltin.cpkg5. About to check it in.

/**/ P ::= QQ[a,b,c];
/**/ RingElemList(P, "[a*b]");
[a*b]

It is not documented (yet). Let's try it first.
BTW, RingElems is not documented either. 2020-10-14: now it is documented!

In fact, this make sense in CoCoA-5, and not really in CoCoALib, where the C++14 syntax for a vector is with curly brackets.

#5 Updated by Anna Maria Bigatti over 4 years ago

  • Related to Feature #1243: New function: Read a string into a list (of RingElem) -- CoCoA-5 added

#6 Updated by John Abbott over 4 years ago

The issue about allowing [...] or not is similar (in my mind) to the issue about a semicolon at the end ReadExprSemicolon.

Qn: why do we have RingElem and ReadExprSemicolon -- as I wrote in #1052 comment 10, I do not much like the name ReadExprSemicolon
because it seems wrong to me that the terminating char/string appears in the name of the fn.

See also issues #209 and #1052.

#7 Updated by John Abbott about 4 years ago

  • Target version changed from CoCoALib-0.99700 to CoCoALib-0.99800

#8 Updated by Anna Maria Bigatti about 4 years ago

  • Subject changed from RingElems: [ and ] not allowed to RingElems: syntax with [ and ] ?
  • Description updated (diff)
  • Status changed from In Progress to Resolved
  • Assignee set to Anna Maria Bigatti
  • % Done changed from 40 to 80

Made it more robust with empty list.

#9 Updated by John Abbott over 3 years ago

I would like to see a minor improvement: allow whitespace before the initial [ and after the final ].
It will complicate the code slightly.

Here are some test cases:

RingElemList(R,"[]");
RingElemList(R," [ ] ");
RingElemList(R, "[x,y,z]");
RingElemList(R, " [ x , y , z ] ");

There should also be some tests using TAB character instead of space.

#10 Updated by John Abbott over 3 years ago

I have changed RingElemList (in NotBuiltin.cpkg5).
I have added a new test test-RingElems.cocoa5 with the tests mentioned in comment 9.

#11 Updated by John Abbott over 3 years ago

#12 Updated by John Abbott over 3 years ago

Should RingElemList be ported into CoCoALib? (perhaps with a different name?)
If so, what should it be called?

PS this issue is in "CoCoALib" rather than "CoCoA-5"

#13 Updated by John Abbott over 3 years ago

Note that we have CoeffVecWRT and CoeffListWRT. So it would be reasonable to call the CoCoALib fn RingElemVec.

#14 Updated by John Abbott over 3 years ago

  • Status changed from Resolved to Feedback
  • % Done changed from 80 to 90

I have implemented RingElemVec; the code is mostly shared with RingElems.

#15 Updated by John Abbott over 3 years ago

Remove the CoCoA-5 and make it call the cocoalib version.

#16 Updated by John Abbott over 3 years ago

The C++ version does not work: WhatsNext causes too much trouble :-(

Groan...

#17 Updated by John Abbott over 3 years ago

My copy works ok, but I must devise tests.

#18 Updated by John Abbott over 3 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100
  • Estimated time set to 5.77 h

I have added some tests (to test-RingElem5.C).
All seems OK. Closing.

Also available in: Atom PDF