home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.prolog
- Path: sparky!uunet!infonode!ingr!capalo!quintus!quintus!ludemann
- From: ludemann@quintus.com (Peter Ludemann)
- Subject: Re: Occurs check
- Message-ID: <1992Dec18.190711.1063@quintus.com>
- Sender: news@quintus.com (USENET news account)
- Nntp-Posting-Host: ebisu
- Organization: Quintus Corporation, Palo Alto, CA
- References: <1992Dec13.173016.8849@nntp.hut.fi> <1992Dec17.111142.24450@dcs.qmw.ac.uk> <24435@alice.att.com> <1992Dec17.185017.17766@cs.uoregon.edu>
- Date: Fri, 18 Dec 1992 19:07:11 GMT
- Lines: 23
-
- In article <1992Dec17.185017.17766@cs.uoregon.edu>, debray@majestix.cs.uoregon.edu (Saumya K. Debray) writes:
- > Fernando Pereira writes:
- > > Nonetheless, the efficiency reasons that led to Prolog's
- > > unification not having the check are pretty compelling, so I do not advocate
- > > adding it to Prolog in all cases.
- >
- > While I believe this statement, it would be interesting to actually see some
- > numbers (preferably for programs other than nrev) ...
-
- An extreme example is "append" for difference lists (no flames on the
- terminology, please!). Without the occurs check, the cost is O(1);
- with the occurs check, the cost is O(n) on the size of the terms (in
- other words, it gets the same cost as regular append). Normally, the
- programmer knows that the occurs check isn't needed, so this is a big win.
-
- Without the occurs check, "infinite" or "rational" terms can be produced.
- I've seen one practical use for them, for representing the fixpoint
- of a recursive program as a term. No doubt, there are other uses.
-
- -----
-
- Peter Ludemann
-
-