Ralf Hemmecke wrote:
>
> rsl : List(L) := [ss.sub, ss.sup, ss.presup, ss.presub]
> while not empty? rsl and empty? first rsl repeat rsl := rest rsl
> sl: List L := [commaSeparate z for z in rsl]
That would skip script at start, not at the end. Building list
in reverse order is a standard list processing method. So
I doubt that you can write something clearer than the while
loop that I wrote.
More generally, I try to write simple and compact code. However
I do not try to produce "optimal" code. When given piece is
good enough I move to the next. Otherwise I would not be
able to write anything substantial. So, if there is some
gross inefficency or unnecessary complication then code
is worth revisiting. But trying to squeeze strightforward
code into smaller number of lines is probably not productive.
> > And we have to skip scripts because otherwise we would get ugly
> > output.
>
> Well... can you give an example?
>
t := OrderedVariableList([script(a, [[],[1],[],[]])])
(6) OrderedVariableList([a[;1]])
Without skipping symbol inside would be 'a[;1;;]'.
>
> > We can omit test for '#sl = 1'. I special case '#si = 1' because
> > this leads to different OutputForm and I wanted maximal compatibility
> > with old code (which did the same).
>
> OK, but eventually OutputForm should not have so many special cases.
>
> In fact, also the treatment of scripted symbols in Symbol is somewhat
> strange. It encodes the numbers of sub/super/presuper/presub scripts
> into the name of the symbol, and then concats all scripts into a flat
> list. Why not storing something like script('a, [[x1,x2],[y1],[z1,z2]]) as
>
> (a (x1 x2) (y1) (z1 z2))
>
> ? If that is a performance issue when comparing symbols then we should
> think of creating a hashtable for scripted symbols (indexed by Lisp
> symbols). So all elements of Symbol are lisp symbols but some of them
> appear in the hash table and would have to be translated into scripted
> symbols at output time.
Well, I guess that the current representation was choosen to have
some chance of handling scripted symbols at Lisp level. With
handling at Spad level we should be able to change representation.
--
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.