Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!newstop!sun!quintus!dave From: dave@quintus.UUCP (David Bowen) Newsgroups: comp.lang.prolog Subject: Re: Bootstrapping precedence grammars. Message-ID: <1236@quintus.UUCP> Date: 2 Aug 89 03:17:12 GMT References: <3635@csd4.milw.wisc.edu> Reply-To: dave@quintus.UUCP (David Bowen) Organization: Quintus Computer Systems, Inc. Lines: 21 > op(Prec, Type, Rator) > > cannot be used in the mode > > op(OUTPUT, OUTPUT, INPUT), > > to find the precedence and fixity of an operator, but only in the mode > > op(INPUT, INPUT, INPUT). The predicate that you need is current_op/3. This can be called with any or all of its arguments unbound. There is a reasonably well-accepted rule that predicates which cause side-effects, like op/3, should be kept separate from predicates which merely inspect the state of the system, like current_op/3. A benefit of this rule is that if you accidentally call a predicate like op/3 with an unbound variable as an argument, you should get an error, rather than having the goal either fail quietly or fill in some value and continue.