Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!news.moneng.mei.com!uwm.edu!msunews!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!lee
From: lee@munta.cs.mu.OZ.AU (Lee Naish)
Subject: Re: Nondeterminism
Message-ID: <9434914.27806@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU
Organization: Department of Computer Sci, University of Melbourne
References: <9434021.28025@mulga.cs.mu.OZ.AU> <D0Jt09.KBy@ecrc.de>
Date: Thu, 15 Dec 1994 03:44:00 GMT
Lines: 31

In article <D0Jt09.KBy@ecrc.de> thom@ecrc.de writes:
>>        - nondet:                   38 (  1.72%)
>
>Nondeterminism seems to be rare in logic programs. 
>
>So why don't we get rid of the overhead of global/implicit search
>by chronological backtracking in favor of local/explicit search
>constructs ?

Quiet!  There may be functional programmers present:-)

In Mercury the nondeterminism is explicit in that nondet procedures are
declared as such.  There is often a pretty fine (and blurred) line
between implicit and explicit (eg, implicit vs explicit parallelism
arguments have always been confusing and confused in my opinion).
Determinism could be made implicit in Mercury by making it the default
(saving 7 characters in most predicate definitions!).  

Fergus and Tom have pointed out that the statistics for the Mercury
compiler are somewhat biased towards deterministic code.  Even so, I
think its reasonable to say that most Prolog code is deterministic and
yet we do pay (some of) the cost of nondeterminism for deterministic
code.  Addressing this problem is an important issue in language design
and implementation.  In Mercury the runtime cost is very small (perhaps
zero) since there is a separate execution model for deterministic code.
The main cost in Mercury is that programmers must put declarations in the
code.  If you are primarily interested in efficiency this is obviously a
good thing (and there are other arguments for having declarations).

	lee

