Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!lee From: lee@munnari.oz.au (Lee Naish) Newsgroups: comp.lang.prolog Subject: Re: delayed computation challenge Keywords: NU-Prolog delays quicksort Message-ID: <2950@munnari.oz.au> Date: 21 Dec 89 07:31:57 GMT References: <2235@cs-spool.calgary.UUCP> <2948@munnari.oz.au> Sender: news@cs.mu.oz.au Reply-To: lee@munmurra.UUCP (Lee Naish) Organization: Comp Sci, University of Melbourne Lines: 34 In article <2948@munnari.oz.au> lee@munmurra.UUCP (Lee Naish) writes: >10?- qsort(X, [1, 3, 2]). >Warning: Goal floundered. >X = X > >It would be nice to run the goal backwards inside the debugging >environment, which has a facility for testing goals using a fair search >strategy. Unfortunately it doesn't seem to work for this example It seems I was using an out of date version of the debugging environment. It actually does work: 8?- test qsort(X, [1, 2, 3]). Do static analysis? n Test known valid instances? Test known satisfiable atoms? Test known unsatisfiable atoms? Generate solutions to goal? Solution found: qsort([3, 2, 1], [1, 2, 3]). qsort([3, 2, 1], [1, 2, 3]) Valid? Solution found: qsort([3, 1, 2], [1, 2, 3]). qsort([3, 1, 2], [1, 2, 3]) Valid? Solution found: qsort([2, 1, 3], [1, 2, 3]). qsort([2, 1, 3], [1, 2, 3]) Valid? Solution found: qsort([2, 3, 1], [1, 2, 3]). qsort([2, 3, 1], [1, 2, 3]) Valid? Solution found: qsort([1, 3, 2], [1, 2, 3]). qsort([1, 3, 2], [1, 2, 3]) Valid? Solution found: qsort([1, 2, 3], [1, 2, 3]). qsort([1, 2, 3], [1, 2, 3]) Valid? It gets into the (unavoidable) infinite loop after this. lee