Re: trail stack, global stack
- From: Jens Kilian <jjk@xxxxxxx>
- Date: 13 Jun 2005 20:59:24 +0200
"blindsearch" <dpatte3@xxxxxxxxxxx> writes:
> Is there anyway to clean up the global and trail stacks during execution?
The classical trick, if your program doesn't need to backtrack (i.e., really
leaves no choice points), is the double negation:
foo :-
\+ \+ some_expensive_computation,
foo.
If you need to pass state around, it gets ugly:
foo(State0) :-
\+ \+ ( some_expensive_computation(State0, State1),
assert(saved_state(State1))
),
retract(saved_state(State)),
!,
foo(State).
--
mailto:jjk@xxxxxxx As the air to a bird, or the sea to a fish,
http://www.bawue.de/~jjk/ so is contempt to the contemptible. [Blake]
http://del.icio.us/jjk
.
- Follow-Ups:
- Re: trail stack, global stack
- From: Jan Wielemaker
- Re: trail stack, global stack
- References:
- trail stack, global stack
- From: blindsearch
- trail stack, global stack
- Prev by Date: Re: negotiation by failure- list operations
- Next by Date: Re: negotiation by failure- list operations
- Previous by thread: trail stack, global stack
- Next by thread: Re: trail stack, global stack
- Index(es):
Relevant Pages
|
|