Hi ECLiPSe users, I'm trying to understand the working of the simple_findall/2 example shown in section 4.4.1 of the Tutorial (v. 21 Apr 07). Here is the simple_findall/2 example: %From section 4.4.1: simple_findall(Goal, Solutions) :- bag_create(Bag), ( call(Goal), bag_enter(Bag, Goal), fail ; bag_dissolve(Bag, Solutions) ). Here is a run using it: [eclipse 9]: simple_findall(member(1, [2, 3, 5, 1, 3, 6, 1, 1]), Solns). Solns = [member(1, [2, 3, 5, 1, 3, 6, 1, 1]), member(1, [2, 3, 5, 1, 3, 6, 1, 1] ), member(1, [2, 3, 5, 1, 3, 6, 1, 1])] Yes (0.00s cpu) The interesting thing is how the solution set consists of the same thing three times, for the three times that the symbolic atom "1" appears in the list. What I was unsure of was the use of the "fail" and how bag_enter/2 collects the individual solutions. The top "half" of the parenthesized disjunction is a conjuction with one of the terms being "fail". Shouldn't the whole conjuction fail, then? I read the help on bag_enter/2 and to be honest I didn't get much out of it. There is a main paragraph that discusses the unordered nature of the bag etc. It ends with a sentence that doesn't "click" for me: "In particular, if the term contains variables, they lose their identity and are replaced with fresh ones." What does this say? :-) Thanks in advance for any insight. Chuck Lutz Lockheed Martin Systems of Systems Engineering BMC4I Modeling and Simulation Moorestown, NJ (856)638-7234 (office) charles.d.lutz_at_...53... "A graphic is never an end in itself; it is a moment in the process of decision making." - Jacques BertinReceived on Tue May 08 2007 - 15:53:22 CEST
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST