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
predicate. 
See example below:

For example,

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


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,

Vassilis

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

Hi,

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.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
ECLiPSe-CLP-Users mailing list
ECLiPSe-CLP-Users_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
Received on Tue Apr 13 2010 - 14:13:18 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST