Ralf Hemmecke wrote:
> 
> On 03/26/2014 03:05 AM, Waldek Hebisch wrote:
> > Ralf Hemmecke wrote:
> >> 
> >> outputTran contains something like this...
> >> 
> >> VECP x => outputTran ['BRACKET,['AGGLST,:[x.i for i in 0..MAXINDEX
> >> x]]]
> >> 
> >> In order to translate that into spad I need to be able to deal
> >> with arrays in OutputForm.
> > 
> > I would first check it that case is used at all.  I do not think 
> > algebra produces such thing as OutputForm.
> 
> Aha. But in PrimitiveArray we have
> 
>    Qnew ==> MAKE_-ARRAY$Lisp
>    Qnew1 ==> MAKEARR1$Lisp
> 
>    empty() == Qnew(0$Lisp)
>    new(n, x) == Qnew1(n, x)
> 
> https://github.com/hemmecke/fricas-svn/blob/master/src/algebra/array1.spad.pamphlet#L22
> 
> So at least we have arrays possibly occuring.

Of course Lisp arrays are used as representaton of Spad object.
But coercion to OutputForm is supposed to use provided
helpers.  We can not exclude some wild 'pretend', but that
would be algebra bug.  So we can reasonably assume that
OutputForm coming from algebra does not contain such
things.

There is a real danger, namely a bunch of call to 'mathprint'
spread around interpreter.  AFAIK calls in 'trace.boot'
are harmless, they call coercion to OutputForm first.
The one in 'g-error.boot' is called via Spad 'error' which
is now type checked, so shoud be OK.  Call in 'msgdb.boot'
looks fishy, but there is chance that '%m' formatting
sequence is not used at all.  Then there are calls in
'i-syscmd.boot' and 'i-map.boot'.  At least in some cases
they pass things to 'mathprint' without going trough
coercion to OutputForm, so that needs to be checked.

> > If vectors gets here, then probably caller is wrong.
> 
> Indeed OneDimensionalArrayAggregate transforms that into a list for
> OutputForm, but it's unclear whether an Array still cannot occur.
> Perhaps it comes back through some error message during a failed
> compilation? I feel unable to really test that, in other words, I guess
> VECP has the be kept in the SPAD code until it is really clear that this
> case doesn't appear. Maybe we can add a message that tells a user to
> report if this branch is selected.

I use 'BREAK()' for this: it traps to Lisp debugger, so is hard
for users to ignore. 
> 
> As far as I have understood i-output.boot, it looks as if that is used
> not only for algebra output, but also to print general domain
> expressions. Why else would I see something like "return" or this
> 
>   op = 'LAMBDA_-CLOSURE => 'Closure
>   op = 'IF       => outputTranIf x
>   op = 'COLLECT  => outputTranCollect x
>   op = 'REDUCE   => outputTranReduce x
>   op = 'REPEAT   => outputTranRepeat x
>   op = 'SEQ      => outputTranSEQ x
> 
> in outputTran?

Look at the following:

outputFormat(x,m) ==
  -- this is largely junk and is being phased out
  ....

I think it explains it well.

-- 
                              Waldek Hebisch
[email protected] 

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to