|
|
|
last edited 11 years ago by test1 |
| 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}
For example:
n:TwoDimensionalArray Union ( Integer,Float):=new(2, 2, 0)
| (1) |
should display a rectangular array of numbers.
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
Union(INT,FLOAT) has KOERCE OUTFORM
| (2) |
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:
n:TwoDimensionalArray Union(Integer,Float):=new(2, 2, 0)
| (3) |
n::OUTFORM::SEX
| (4) |