login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #200 display of TwoDimensionalArray of type Union(...) is not properly formatted revision 2 of 2

1 2
Editor: test1
Time: 2014/05/06 17:02:11 GMT+0
Note:

added:

From test1 Tue May 6 17:02:11 +0000 2014
From: test1
Date: Tue, 06 May 2014 17:02:11 +0000
Subject: 
Message-ID: <20140506170211+0000@axiom-wiki.newsynthesis.org>

Status: open => not reproducible 


Submitted by : (unknown) at: 2007-11-17T22:07:43-08:00 (15 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

For example:

axiom
n:TwoDimensionalArray Union ( Integer, Float):=new(2,2,0)

\label{eq1}\left[ 0, \: 0, \: 0, \: 0 \right](1)
Type: TwoDimensionalArray?(Union(Integer,Float))

should display a rectangular array of numbers.

I debugged this a little but hit a wall. In ARR2CAT you find the appropriate conversion operation:
    if R has CoercibleTo(OutputForm) then

      coerce(m:%) ==
        l : List List OutputForm
        l := [[qelt(m,i,j) :: OutputForm _
                  for j in minColIndex(m)..maxColIndex(m)] _
                  for i in minRowIndex(m)..maxRowIndex(m)]
        matrix l

which really looks alright. Note also, that

axiom
Union(INT, FLOAT) has KOERCE OUTFORM

\label{eq2} \mbox{\rm true} (2)
Type: Boolean

and the operation is not overridden in ARRAY2 or IIARRAY2. But the miracle is, inserting a print("hi")$Lisp in the above operation shows that it actually doesn't get invoked. Somehow it seems to me that rather the following function from HOAGG gets invoked:

       coerce(x:%):OutputForm ==
         bracket
            commaSeparate [a::OutputForm for a in parts x]$List(OutputForm)

which can be seen by looking at:

axiom
n:TwoDimensionalArray Union(Integer, Float):=new(2,2,0)

\label{eq3}\left[ 0, \: 0, \: 0, \: 0 \right](3)
Type: TwoDimensionalArray?(Union(Integer,Float))
axiom
n::OUTFORM::SEX

\label{eq4}\left(\hbox{\axiomType{BRACKET}\ } \ {\left(\hbox{\axiomType{AGGLST}\ } \  0 \  0 \  0 \  0 \right)}\right)(4)
Type: SExpression?

Status: open => not reproducible