Re: newbie: Out of local stack, matching values from 0 to 10
- From: Matthijs Wensveen <mrw@xxxxxxxxxx>
- Date: Wed, 25 May 2005 19:29:27 +0200
Hello Jan and Bart,
Thanks for the information.
I had never heard of tabling and XSB before, so I gave it a quick google. I can't say I understand it. I have little knowledge about resolution, but I understand tabling is another approach? I think I'll dig up my prolog books and read up on tabling, might be interesting..
For the time being, between(0, 9, X). Is good enough for me :)
Thanks again, Matthijs.
Bart Demoen wrote:
Jan Wielemaker wrote:
in_bounds(0).
in_bounds(X) :- in_bounds(Y), X is Y + 1, X < 10. ---
[..]
A Prolog system with tabling like XSB will (as far as I understand it) fix this. (but not for in_bounds(-1), right?)
No. I assume you added :- table in_bounds/1. to the program.
Then also the query ?- in_bounds(-1). finishes in XSB, because:
the goal with -1 does not unify with the first head the goal with -1 unifies with the second head, and in the body a new subgoal in_bounds(Y) is spawned and you were already convinced that when in_bounds is called with a free var, it finishes after some time, so this goal also consumes its answers - there are exactly 10 values for Y, but none of them is 1 less than the -1 (the X), so failure results
Right ?
Tabling is wonderfull, isn't it !
Cheers
Bart Demoen
.
- References:
- newbie: Out of local stack, matching values from 0 to 10
- From: Matthijs Wensveen
- Re: newbie: Out of local stack, matching values from 0 to 10
- From: Jan Wielemaker
- Re: newbie: Out of local stack, matching values from 0 to 10
- From: Bart Demoen
- newbie: Out of local stack, matching values from 0 to 10
- Prev by Date: Re: Who needs types if we have terms?
- Next by Date: Re: Who needs types if we have terms?
- Previous by thread: Re: newbie: Out of local stack, matching values from 0 to 10
- Next by thread: Problem
- Index(es):
Relevant Pages
|
|