Bill Page wrote:
>
> Waldek,
>
> I added the follow statements to 'form2String1'
>
> op = "::" =>
> null argl => '"::"
> lo := form2String1 first argl
> argl := rest argl
> [lo, '"::", form2String1 first argl]
>
> to handle unparse of the '::' operator.
>
> http://axiom-wiki.newsynthesis.org/SandBoxUnparse#bottom
>
> Please let me know if you have any comments or if you know a better way ...
>
AFAICS we need "::" (coercion), "$" (package call) and "@" (required
result type). In general we need parentheses around arguments,
in particular both "::" and "@" bind pretty tightly, but in
practice we are likely to apply them to large expressions.
Also, we do not handle logical operators ('not' is correctly
handled by application rule, but 'and' and 'or' are mangled).
Next, "rem" and "quo", comparisons and "SEQ" are just unparsed
as function applications and interpreter parser can handle them in
that form. I am not sure if we really want parser to allow
such prefix forms. If we use such prefix forms we should be
careful to avoid accidentally turning them into infix operators
--> we need a lot of parenthesis
Coming back to your code: to get corrent output you probably
want something like:
argl is [arg1, arg2] and (op = "::" or op = "@" or op = "and" ...) =>
concat('"(", '"(", form2String1 arg1, '")", form2String1 op,_
'"(", form2String1 arg2, '")", '")")
If you want to omit unneeded parentheses you need some extra logic.
Basically either one has to mimic work of parser and comupute
priorities at each node of the form, or one should use a family
of mutually recursive functions (one for each priority class).
I am writing "priority class" because at least in some cases
priorities are _not_ ordered linearly.
BTW. Package calls need a bit more of logic because in source
we have something like "sin(x)$(Expression Integer)" while the
InputForm is:
(($elt (Expression Integer) sin) x)
So, we need code like
op is ["$elt" t op1] and isType(t) =>
concat(form2String1 [op1, :argl], '"$", '"(", form2String1 t, '")")
--
Waldek Hebisch
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---