> < ^ Date: Wed, 12 Mar 2003 17:43:17 +0100
> < ^ From: Jan Draisma <Jan.Draisma@unibas.ch >
> < ^ Subject: Re: Programs

Dear Gap-forum, and Vahid,

There is no problem: the syntax error is merely a warning. For example,

f:=function(n) if n>0 then return g(n-1); else return 0; fi; end;
g:=function(n) if n>0 then return f(n-1); else return 1; fi; end;

yields an, admittedly somewhat inefficient, function f that determines
n mod 2 for natural numbers n.

Best regards,

Jan

answering:
> Dear Gap-Froum,
>
> I have written a recursive program on GAP which contains two
> subroutines A and B such that A calls B, and B calls A.
> When I define A at the first, GAP does not know B.
> and when I define B, it does not know A. And I receive
> "Syntax error: warning: unbound global variable".
> Do you know How I can fix that?
>
> Thanks,
> Vahid Dabbaghian

Miles-Receive-Header: reply


> < [top]