Olivier Thirifay wrote: > > once intersection([1,2,3,4],[2,4],Result) like the example in doc > once member(X,[1,2,3]) > > BUT ECLiPSe return all the results. intersection([1,2,3,4],[2,4],Result) has only one solution, viz Result = [2,4] member(X,[1,2,3]) has 3 solutions X = 1 X = 2 X = 3 When you use once, you get the first solution, so it makes no difference for intersection. It seems what you wanted was not the intersection-list, but the common list elements. You could define member_of_both(List1, List2, Elem) :- member(Elem, List1), member(Elem, List2). and then call once member_of_both([1,2,3,4],[2,4],Result). -- Joachim Schimpf / phone: +44 20 7594 8187 IC-Parc, Imperial College / mailto:J.Schimpf@ic.ac.uk London SW7 2AZ, UK / http://www.icparc.ic.ac.uk/eclipseReceived on Fri Oct 19 10:50:07 2001
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:10 PM GMT GMT