Project

General

Profile

Design #1041

Separators for elements of a list

Added by John Abbott almost 7 years ago. Updated 3 months ago.

Status:
In Progress
Priority:
Normal
Assignee:
-
Category:
enhancing/improving
Target version:
Start date:
07 Apr 2017
Due date:
% Done:

10%

Estimated time:
Spent time:

Description

Currently elements of a "list" are printed with comma-space-space between successive elements.

The string defining this separator is written out several times:
  • VectorOperations.H
  • Interpreter.C
  • TmpF5Mat.C (twice)
  • ideal.C

Does it make sense for CoCoALib to offer a public string whose value is the separator used in CoCoALib between elements when printing lists? Discuss & decide!

Note that elements in a matrix use a different separator!

History

#1 Updated by John Abbott almost 7 years ago

I have put this in the section CoCoA-5 even though the solution involves (possibly) modifying CoCoALib,
because the problem becomes evident in CoCoA-5 (which should print its lists compatibly with those in CoCoALib).

I'm not sure about separators between elements in a matrix... :-/

#2 Updated by John Abbott almost 7 years ago

Here is an example involving a matrix:

>>> M := mat([[1,2],[3,4]]);
>>> M;
matrix(QQ,
 [[1, 2],
  [3, 4]])
>>> indent(GetRows(M));
[
  [1,  2],
  [3,  4]
]

#3 Updated by John Abbott almost 3 years ago

  • Target version changed from CoCoA-5.?.? to CoCoA-5.4.0

I am not so sure about it being useful to allow a user to change the string.
However, it would be a good idea to have a single string (constant?) which contains the separator; rather than having the separator string being defined in several places.

It is also unclear whether entries in a matrix should be separated by the same string...
I would expect so, but apparently this is not the current situation.

#4 Updated by John Abbott over 2 years ago

  • Target version changed from CoCoA-5.4.0 to CoCoA-5.4.2

#5 Updated by John Abbott 3 months ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

I still agree with my comments in note 3 above.
For matrices, there are really 2 separators: between elements in a row, and between rows.

Proposed action:
  • gather all list element separators into a single constant somewhere (where?)
  • put the matrix separators into two constants
  • perhaps include cross-reference comments between the list separators & the matrix separators?

Also available in: Atom PDF