Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!labrea!sri-unix!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: Determining order of argument unification Message-ID: <647@quintus.UUCP> Date: 8 Nov 88 09:04:20 GMT References: <8192@burdvax.PRC.Unisys.COM> <629@quintus.UUCP> <8210@burdvax.PRC.Unisys.COM> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 21 In article <8210@burdvax.PRC.Unisys.COM> lang@zeta.PRC.Unisys.COM (Francois-Michel Lang) writes: >> In article <8192@burdvax.PRC.Unisys.COM> lang@zeta.PRC.Unisys.COM (Francois-Michel Lang) writes: >> >Is it possible to determine (by writing a Prolog program) >> >which of these two orders is used for given a Prolog system, >if we assume that the Prolog system one is running >(1) does indeed use left -> right or right -> left order, >(2) uses it consistently, and >(3) can't handle cyclic terms. Why not simply assume that it uses right->left order consistently and make the problem _really_ easy? My earlier reply did not exhaust all the things that a Prolog system might sensibly do instead. Imagine a Prolog system where the compiler replaces all variables in the head by new distinct variables, and then at the end unifies repeated variables pairwise, e.g. p([H|T], L, [H|R]) :- => p([H|T], L, [H'|R]) :- H = H' If the goal is acyclic, the (simplified) head unification is order- independent; what matters is the order in which the repeated variables are handled. And that might quite plausibly depend on the spelling of the source variables. I tell you plainly that Quintus Prolog violates Lang's assumptions.