Project

General

Profile

Bug #1288

len for RINGELEM ?!?

Added by John Abbott almost 5 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
bug
Target version:
Start date:
24 May 2019
Due date:
% Done:

100%

Estimated time:
1.01 h
Spent time:

Description

I was surprised to discover that len can be applied to a RINGELEM.

f := x+1;
len(f);
2

The manual says len can be applied only to STRING or LIST.
(use NumTerms instead!)

History

#1 Updated by John Abbott almost 5 years ago

The manual entry for len looks a bit strange, and is hard to read. It says the fn signature is

len(E: STRING|LIST): INT

I think it would be clearer to write two separate signatures.

Also ?Commands and Functions for LIST does not list len; probably the automatic parser does not recognise the funny signature...

NOTE I have just modified the signature in my personal copy, and now len does appear in the list of fns for LIST.

#2 Updated by John Abbott almost 5 years ago

The source code for the function len is in file BuiltinFunctions-CoCoALib.C around line 100.

The code recognises the types STRING, LIST, RINGELEM, MAT and MatrixRowValue.
The last two give helpful error messages, but for RINGELEM it calls NumTerms; surely this should also give a helpful error message?

#3 Updated by John Abbott over 4 years ago

  • Priority changed from Normal to High
  • Target version changed from CoCoA-5.3.0 to CoCoA-5.4.0

#4 Updated by John Abbott over 4 years ago

  • Status changed from New to Feedback
  • Assignee set to John Abbott
  • Target version changed from CoCoA-5.4.0 to CoCoA-5.3.0
  • % Done changed from 0 to 90

The CoCoA-5 manual page has already been fixed.

I have just modified BuiltinFunction-CoCoALib.C so that an error is given if len is applied to a RINGELEM (no check that the ringelem is from a poly ring). I had to change one lone in tests/anna.cocoa5, and now everything seems fine.

One could argue that len(RINGELEM) should be "obsolescent", but that would make things awfully complicated (possibly without much benefit).

#5 Updated by Anna Maria Bigatti over 4 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

#6 Updated by Anna Maria Bigatti over 4 years ago

  • Estimated time set to 1.01 h

#7 Updated by Anna Maria Bigatti about 4 years ago

  • Description updated (diff)

Also available in: Atom PDF