[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [fricas-devel] Re: [Axiom-mail] Programming with BTREEs.
From: |
Martin Rubey |
Subject: |
Re: [fricas-devel] Re: [Axiom-mail] Programming with BTREEs. |
Date: |
07 Apr 2009 14:54:34 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Martin Rubey <address@hidden> writes:
> Dear Ralf,
>
> I'm extremely grateful that you answered...
>
> Ralf Hemmecke <address@hidden> writes:
> N := Union(Symbol, List Integer)
> BT := BinaryTree N
> B ==> binaryTree -- the 3-argument version
> V ==> binaryTree -- the 1-argument version
> bt:BT:=B(V e,[5,1],B(B(V a,[1,1],V b),[1,1],B(V c,[1,2],V d)))
>
> [...]
>
> S==>Symbol
> L==>List Integer
> construct(x: S, l: L, y: S): BT == binaryTree(V(x::N), l::N, V(y::N))
> bt2: BT := [e,[5,1],[[a,[1,1],b],[1,1],[c,[1,2],d]]]
>
> ['a, [1,3], 'address@hidden
>
> works for me
>
> but
>
> [e,[5,1],[[a,[1,1],b],[1,1],[c,[1,2],address@hidden
>
> cannot work, I think, because the argument types don't match. You
> will need to allow also binary trees.
construct(x: Union(S, BT), l: L, y: Union(S, BT)): BT == binaryTree((if x case
S then V(x::N) else x::BT), l::N, (if y case S then V(y::N) else y::BT))
will work *almost*:
(20) -> ['a, [1,3], ['d, [1,3], 'address@hidden@BT
(20) [a,[1,3],[d,[1,3],c]]
Type:
BinaryTree(Union(Symbol,List(Integer)))
(21) -> ['a, [1,3], ['d, [1,3], 'address@hidden
Conversion failed in the compiled user function construct .
Cannot convert from type List(Any) to Union(Symbol,BinaryTree(Union(
Symbol,List(Integer)))) for value
[d,[1,3],c]
Not sure whether this is an improvement.
Martin