Dear ECLiPSe Users, in section 16.9.2 the following program is given: delay filter(_, Li, Lo) if var(Li), var(Lo). filter(_, [], []) :- !. filter(P, [N|LI], LL) :- (N mod P =\= 0 -> LL = [N|NLI], filter(P, LI, NLI) ; filter(P, LI, LL) ). delay integers(_, List) if var(List). integers(_, []). integers(N, [N|Rest]) :- N1 is N + 1, integers(N1, Rest). The goal :- integers(2,L), filter(2,L,[N|R]). works as expected and produces the result: L = [2, 3|LI] N = 3 R = R Delayed goals: integers(4, LI) filter(2, LI, R) yes. But the goal :- integers(2,L), filter(2,L,[N|R]), R = [M|S]. results in the error message: instantiation fault in mod(N, 2, _262) The manual says that the delayed integers goal is woken before the conditional is executed. Therefore, N should be instantiated to an integer. Any comments? -- Jörg Harm jh@informatik.uni-rostock.de Fachbereich Informatik, Universität Rostock, D-18051 Rostock Telefon: +49-381-4983432 Fax: +49-381-4983426Received on Tue Mar 9 12:10:33 1999
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:04 PM GMT GMT