[bp-users]Re: B-Prolog Version 6.4 Available
Neng-Fa Zhou
nzhou@acm.org
Tue, 18 Mar 2003 16:07:51 -0500
Hi,
The new tabling system in B-Prolog employs a strategy called "lazy
consumption strategy", under which a tabled subgoal consumes answers until
all the clauses are explored. For the fib example, you experience table area
overflow or stack overflows because of the lack of cuts in the first two
clauses. The program should be rewritten to:
:-table fib/2.
fib(0, 1):-!.
fib(1, 1):-!.
fib(N,F):-N1 is N-1, N2 is N-2,fib(N1,F1),fib(N2,F2),F is F1+F2.
Regards,
Neng-Fa
> Hi,
> B-Prolog 6.4/Win2K aborts with the first example I tried from the
> examples\tabling directory, ( but other simple code with a tabled
predicate
> succeeds).
>
____________________________________________________________________________
> ______________________
> | ?- [fib].
> consulting....fib.pl
> yes
> | ?- go.
> Enter N : | 1.
> Table area overflow
>
____________________________________________________________________________
> ______________________
> | ?- trace.
> yes
> {Debug mode}
> | ?- go.
> Call: go ?
> Call: write(Enter N : ) ?
> Enter N : Exit: write(Enter N : ) ?
> Call: read(_48016c) ?
> | 0.
> Exit: read(0) ?
> Call: nl ?
>
> Exit: nl ?
> Call: cputime(_480190) ?
> Exit: cputime(45947) ?
> Call: fib(0,_4801ac) ?
> Table area overflow
>
____________________________________________________________________________
> ______________________
>
> The starting batch bp.bat has "set TABLE=1000000". Any idea why it
> overflows?
>
>