Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!news.duke.edu!convex!cs.utexas.edu!howland.reston.ans.net!EU.net!Germany.EU.net!Munich.Germany.EU.net!ecrc!news
From: micha@ecrc.de (Micha Meier)
Subject: Re: numbervars/3 bug in Quintus and Sicstu
Message-ID: <CyBq1K.BAB@ecrc.de>
Sender: news@ecrc.de
Reply-To: micha@ecrc.de
Organization: European Computer-Industry Research Centre
References: <9430016.21535@mulga.cs.mu.OZ.AU>
Date: Thu, 27 Oct 1994 08:53:43 GMT
Lines: 35

In article 21535@mulga.cs.mu.OZ.AU,  lee@munta.cs.mu.OZ.AU (Lee Naish) writes:
>In article <38lgc9$m8k@coli-gate.coli.uni-sb.de> erbach@coli.uni-sb.de (Gregor Erbach) writes:
>There are two main reasons for using numbervars.
>
>The first is as a hack to get variables printed in a nicer way.
>
>>     ?- numbervars(['$VAR'(X),X],0,N).
>
>This goal followed by write(['$VAR'(X),X]) will produce an unexpected
>result with Sicstus.
>
>The second is as a way to get a ground meta level representation of
>possibly non-ground Prolog term.  If the term to be represented contains
>'$VAR'/1 numbervars cannot work, a severe limitation. The mapping
>numbervars implements is many to one so the result is ambiguous.  For
>example, numbervars('$VAR'(0), 0, N) and numbervars(X, 0, N) produce the
>same term.  The Sicstus implementation is no better or worse in this
>regard.

Right. It should be also noted, however, that using numbervars here is
again a hack to achieve amalgamation of object and meta level representation
of a term without translating and/or copying. Attributed variables provided by
eclipse is a much cleaner way to achieve this goal with the same efficiency.

--Micha



---
Micha Meier			------------------------------------------------
ECRC, Arabellastr. 17		The opinions expressed above are private
D-81925 Munich 81		and may not reflect those of my employer.
micha@ecrc.de, Tel. +49-89-92699-108, Fax  +49-89-92699-170


