Serge D. Mechveliani wrote:
> 
> Please, how to fix this program?

Add terminaton test to g?

> 
> ----------------------------------------------- t.spad -------
> )abbrev package FOO1 Foo1
> Foo1() : with   f : Integer -> Integer ==
>   add
>     f(n : Integer) : Integer ==
>                              n = 0 => 0
>                                    1 + (g(n-1) $Foo2)
> 
> )abbrev package FOO2 Foo2
> Foo2() : with   g : Integer -> Integer ==
>   add
>     g(n : Integer) : Integer ==  1 + (f(n-1) $Foo1)
> --------------------------------------------------------------
> 
> Are there possible two packages which call each other?

Yes.  To compile your code do:

)boot $bootStrapMode := true
)compile t.spad
)boot $bootStrapMode := false
)compile t.spad

After that f(6) works fine, while f(5) leads to stack overflow.

-- 
                              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.

Reply via email to