Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!munnari!murtoa.cs.mu.oz.au!munnari.oz!lee From: lee@munnari.oz (Lee Naish) Newsgroups: comp.lang.prolog Subject: Re: Constraint satisfaction in LOG(F) Message-ID: <1353@murtoa.cs.mu.oz.au> Date: 10 Apr 89 01:29:30 GMT References: <1632@kulcs.kulcs.uucp> <1942@randvax.UUCP> Sender: news@cs.mu.oz.au Reply-To: lee@munmurra.UUCP (Lee Naish) Organization: University of Melbourne, Comp Sci Dept Lines: 37 In article <1942@randvax.UUCP> narain@randvax.UUCP (Sanjai Narain) writes: >It is interesting that the NAC compiler can generate coroutining >information automatically. I would be interested in knowing how general >it is. Does the user ever have to specify coroutining annotations, or >does the compiler always do the right thing? Can it handle arbitrary >symbolic generate and test predicates, or did it do a good job because it >knew about +? It works fairly well for programs which manipulate recursive data structures (lists in this example). It doesn't know anything about numbers, which is a limitation. See %A Lee Naish %T Automating control of logic programs %J Journal of Logic Programming %K jlp %V 2 %N 3 %D October 1985 %P 167-183 It might be easier to automate this kind of coroutining in a functional environment because more information is known about modes. However, one of the prices to pay is that tests must explicitly return true or false (rather than just succeeding or failing). Predicates seem nicer than functions for expressing "generate and test" problems. Although coroutining can simulate some uses of lazy evaluation (perhaps more efficiently also), lazy evaluation seems more powerful in general. This is something that functions have over predicates (in my opinion). However, I think logic programming is a good implementation vehicle for mixed "logic"/functional programming. Quite a while back I wrote a preprocessor which compiles NU-Prolog + functions defined by equations down to NU-Prolog. It has (optional) lazy evaluation and fits very nicely with Parallel NU-Prolog, but thats another story... lee