Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!agate!labrea!sri-unix!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: Grammar rule translator. Message-ID: <212@quintus.UUCP> Date: 30 Jul 88 04:58:54 GMT References: <196@quintus.UUCP> <4751@csli.STANFORD.EDU> <202@quintus.UUCP> <2924@mulga.oz> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 25 In article <2924@mulga.oz> lee@mulga.UUCP (Lee Naish) writes: >In article <202@quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes: >>When compiled with the current Quintus Prolog compiler, >> p(..., S0, S) :- 'C'(S0, X, S1), ... >>and >> p(..., [X|S1], S) :- ... >>run at the same speed. > >That is because (correct me if I am wrong) Quintus currently indexes >only on the top level functor of the first argument. Lee Naish is saying 1) Quintus Prolog currently indexes on the principal functor of the first argument (this is true) 2) My statement above is true (which is so) 3) 1) explains 2). This is absolutely wrong. The reason that the two fragments I sketched run at the same speed is that they turn into identical code, and will still turn into identical code if/when better indexing is provided. This applies to *everything* that uses 'C'/3, not just things that happen to use it in the head of a grammar rule. That was my point: the grammar rule translator should not know how smart the compiler is, neat hacks for speeding things up belong in optimising tools that apply to *every* sort of code.