Article View: comp.lang.prolog
Article #3787Re: Determining order of argument unification
From: Micha Meier
Date: Thu, 17 Nov 1988 09:29
Date: Thu, 17 Nov 1988 09:29
29 lines
1825 bytes
1825 bytes
In article <14359@comp.vuw.ac.nz> lindsay@comp.vuw.ac.nz (Lindsay Groves) writes: > - check constant arguments first; these are easy checks to perform, and if > one fails, that saves a lot of other work. > - next check functors on compound terms; same reason as above, but it takes > a bit more work to do. > - next handle first occurrences of variables; these only require bindings to > be created. > - finally handle second and subsequent occurrences of variables; this is the > only place that the full unification algorithm needs to be invoked, so it > shoulb de put off as long as possible. This is basically right, you only have to precisely know why do you choose a specific order: if the unification succeeds, it does not matter in which order the arguments are unified. If it fails, however, we want to find it out as early as possible so that: - we didn't make too many (now redundant) operations before the failure - the number of actions necessary to undo the failed unification is minimized This means that first occurrences of variables should be handled at the end, because they cannot cause failure. The order depends as well on possible mode declarations (input before output) and on the size or "groundness" of compound terms. The (unavailable :-)) compiler of Sepia makes these optimizations. --Micha
Technical Details
Message-ID:
<653@ecrcvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!unido!ecrcvax!michaReferences:
<8192@burdvax.PRC.Unisys.COM> <629@quintus.UUCP> <14359@comp.vuw.ac.nz>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!unido!ecrcvax!micha From: micha@ecrcvax.UUCP (Micha Meier) Newsgroups: comp.lang.prolog Subject: Re: Determining order of argument unification Message-ID: <653@ecrcvax.UUCP> Date: 17 Nov 88 09:29:14 GMT References: <8192@burdvax.PRC.Unisys.COM> <629@quintus.UUCP> <14359@comp.vuw.ac.nz> Reply-To: micha@ecrcvax.UUCP (Micha Meier) Organization: ECRC, Munich 81, West Germany Lines: 29