but
[e,[5,1],[[a,[1,1],b],[1,1],[c,[1,2],d...@bt

cannot work, I think, because the argument types don't match.  You
will need to allow also binary trees.

Ooops. You are completely right.

The last part in the input file can be replaced by

----
S==>Symbol
L==>List Integer
U==>Union(BT,S)

construct(x: U, l: L, y: U): U ==
  u: BT := if x case S then binaryTree(x::N) else x::BT
  v: BT := if y case S then binaryTree(y::N) else y::BT
  binaryTree(u, l, v)::U

l: List U := [a,b,c,d,e]
(a,b,c,d,e):=(l 1, l 2, l 3, l 4, l 5)
u: U := [e,[5,1],[[a,[1,1],b...@u,[1,1],[c,[1,2],d...@u]@U]
bt2: BT := u :: BT
----

where the @U part is necessary (though ugly) since otherwise Axiom (oh, FriCAS in my case) falsely creates

(25) -> [a,[1,2],b]

   (25)  [a,[1,2],b]
                            Type: List(Any)

which is a very unspecific (and bad) choice in the pressence of my new function from above and a and b being both variables of type U.

Yet another instance of why I hate "Any".

Ralf


_______________________________________________
Axiom-mail mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-mail

Reply via email to