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 1 of 2

1 2
Editor:
Time: 2007/11/17 22:07:43 GMT-8
Note:

changed:
-
For example:
\begin{axiom}
n:TwoDimensionalArray Union ( Integer, Float):=new(2,2,0)
\end{axiom}

should display a rectangular array of numbers.

From kratt6 Wed Aug 24 13:34:47 -0500 2005
From: kratt6
Date: Wed, 24 Aug 2005 13:34:47 -0500
Subject: 
Message-ID: <20050824133447-0500@page.axiom-developer.org>

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 
\begin{axiom}
  Union(INT, FLOAT) has KOERCE OUTFORM
\end{axiom}

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:
\begin{axiom}
n:TwoDimensionalArray Union(Integer, Float):=new(2,2,0)
n::OUTFORM::SEX
\end{axiom}

Submitted by : (unknown) at: 2007-11-17T22:07:43-08:00 (17 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?