Re: [eclipse-clp-users] Loop without backtracking

From: Vassilis Liatsos (vliatsos) <"Vassilis>
Date: Tue, 13 Apr 2010 09:12:52 -0500
Hi Christian,

You can use once/1 to wrap around your foreach loop.
It may be better to make your loop a predicate and use once/1 on the
See example below:

For example,

my_loop(Arg1, Arg2, ...) :-
	  foreach(..., ...),

If my_loop leaves some choice points, I can use once/1 to remove them:

once(my_loop(Arg1, Arg2, ...))

I think using findall is not a good idea, since it will explore all
backtrack points.

Hope that helps,


-----Original Message-----
From: Christian Wirth [mailto:tyrion_at_...215...] 
Sent: Tuesday, April 13, 2010 9:17 AM
Subject: [eclipse-clp-users] Loop without backtracking


i need to write a loop (currently using foreach or findall) without 
backtracking: When a single loop body call was succesfull, all 
backtracking information of this loop body call has to be deleted.
I assumed a cut at the end of the loop body would do the trick, but 
thats not the case ...
What can i do ?

best regards Christian Wirth

Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
ECLiPSe-CLP-Users mailing list
Received on Tue Apr 13 2010 - 14:13:18 CEST

This archive was generated by hypermail 2.3.0 : Sat Aug 24 2019 - 21:14:55 CEST