On 10/24/07, Gabriel Dos Reis wrote:
> ...
> Stream is an *example* of a generator like domain. I would not want
> to turn my BinaryTree into a Stream before iterating over it.
>
It seems very natural to me to write:
t:BinaryTree Integer
t:= ...
for i in t repeat ...
but perhaps the meaning is not so clear. Over exact what objects are
we iterating? There are several operations in BinaryTree(S) that
produce 'List S' or 'List %' output, for example:
leaves : % -> List S
nodes : % -> List %
children : % -> List %
members : % -> List S
parts : % -> List S
In any case right now in Axiom you are forced to turn your binary tree
into a List which is surely worse then returning a Stream, no?
Unfortunately there is a bug in 'members':
(1) -> t:BinaryTree(Integer)
Type: Void
(2) -> t:=binaryTree(10)
(2) 10
Type: BinaryTree Integer
(3) -> t:=binaryTree(t,3,binaryTree 20)
(3) [10,3,20]
Type: BinaryTree Integer
(4) -> members t
Function: parts : % -> List Integer is missing from domain: BinaryTree Integer
Internal Error
The function parts with signature (List (Integer))$ is missing from
domain BinaryTree(Integer)
--------
Regards,
Bill Page.
_______________________________________________
Axiom-math mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-math