Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!prlb2!kulcs!bimbart From: bimbart@kulcs.uucp (Bart Demoen) Newsgroups: comp.lang.prolog Subject: Re: Re: Constraint satisfaction in LOG(F) Message-ID: <1632@kulcs.kulcs.uucp> Date: 7 Apr 89 07:50:36 GMT Reply-To: bimbart@kulcs.UUCP (Bart Demoen) Organization: Katholieke Universiteit Leuven, Dept. Computer Science Lines: 17 As a reaction to <1919@randvax.UUCP> narain@randvax.UUCP (Sanjai Narain) and <1333@murtoa.cs.mu.oz.au> lee@munmurra.UUCP (Lee Naish), here is a Prolog program: ans(_l) :- sub(10,[1,11,2,12,3,13,4,14,5,15,6,16,7,17,8,18,9,19,10,20],_l). sub(0,_,[]) :- ! . sub(_n,[_x|_l],[_x|_o]) :- _nn is _n - _x , _nn >= 0 , sub(_nn,_l,_o) . sub(_n,[_|_l],_o) :- sub(_n,_l,_o) . the `breeze' in which it finds the solutions, is about 7 times shorter ... although I am very much convinced of the usefulness of built-in coroutining, I think it is - as in this example - very often an overkill bimbart@kulcs