Thanks, Raphael for explanation.<div><br></div><div>Now I've got te point. I just searched through mailing list archives (sorry for not doing this first) and have found a couple of threads that explains my question rather explicitly</div>
<div><br></div><div><a href="http://www.mercury.csse.unimelb.edu.au/mailing-lists/mercury-users/mercury-users.200702/0007.html">www.mercury.csse.unimelb.edu.au/mailing-lists/mercury-users/mercury-users.200702/0007.html</a></div>
<div><a href="http://www.mercury.csse.unimelb.edu.au/mailing-lists/mercury-users/mercury-users.200702/0007.html"></a><a href="http://www.mercury.csse.unimelb.edu.au/mailing-lists/mercury-users/mercury-users.0205/0056.html">www.mercury.csse.unimelb.edu.au/mailing-lists/mercury-users/mercury-users.0205/0056.html</a></div>
<div><a href="http://www.mercury.csse.unimelb.edu.au/mailing-lists/mercury-users/mercury-users.0205/0056.html"></a><br>Btw. To whom this is related.. It seems that search through mailing list archive is broken is sense that it returns the google search results but all links point to 404 page (they point to <a href="http://www.cs.mu.oz.au/.">http://www.cs.mu.oz.au/.</a>.. rather then to <a href="http://www.mercury.csse.unimelb.edu.au/mailing-lists/mercury-users/mercury-users.200702/0007.html">www.mercury.csse.unimelb.edu.au</a>). </div>
<div><br></div><div>Sincerely yours,</div><div>Vladimir</div><div><br></div><div>On Thu, Apr 15, 2010 at 11:17 AM, Raphael Collet <span dir="ltr"><<a href="mailto:rco@missioncriticalit.com">rco@missioncriticalit.com</a>></span> wrote:<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Dear Vladimir,<br>
<br>
Mercury is not a real logic programming language. Think of it as a functional language syntactically dressed like a logic language. But the fundamentals of logic programming (the logic variables) have been ruled out of the language.<br>
<br>
I have tried myself to figure out how to use modes to extend the usability of the language (in the LP sense), but I gave up. Modes and insts are too limited in practice to do that. Partially instantiated data structures are not supported, and AFAIK there is no plan to support it in the near future.<br>
<br>
Regards,<br>
Raphael<br>
<br>
<br>
Vladimir Gubarkov wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">
Hi, dear sirs<br>
<br>
I'm trying to gain with mercury the next prolog idiom:<br>
<br>
% code<br>
f(A) :-<br>
A = a(B,B).<br>
<br>
% query<br>
?- A = a(7,X), f(A).<br>
A = a(7, 7),<br>
X = 7.<br>
<br>
I tried to write something like:<br>
<br>
<br>
:- module ref.<br>
<br>
:- interface.<br>
<br>
:- import_module io.<br>
%:- import_module list.<br>
<br>
:- pred main(io, io).<br>
:- mode main(di, uo) is det.<br>
<br>
:- implementation.<br>
<br>
<br>
:- type a_type ---> a(int, int).<br>
<br>
:- inst a_inst ---> a(ground, free).<br>
:- mode a_mode == a_inst >> ground.<br>
<br>
:- pred f(a_type).<br>
:- mode f(a_mode) is semidet.<br>
<br>
f(A) :-<br>
A = a(B,B).<br>
<br>
main --><br>
{<br>
(<br>
f(a(7,Q1))<br>
-><br>
Q = Q1<br>
;<br>
Q = -1<br>
)<br>
},<br>
io.write_int(Q),<br></div></div>
<a href="http://io.nl" target="_blank">io.nl</a> <<a href="http://io.nl" target="_blank">http://io.nl</a>>.<div class="im"><br>
<br>
But mercury (btw, I'm using rotd-2010-04-01-unstable) persistently complains on this like follows:<br>
<br>
$ mmc -e ref.m<br>
ref.m:023: In clause for `f((ref.a_mode))':<br>
ref.m:023: mode error in unification of `A' and `ref.a(B, V_4)'.<br>
ref.m:023: Variable `A' has instantiatedness `bound(ref.a(ground, free))',<br>
ref.m:023: term `ref.a(B, V_4)' has instantiatedness `ref.a(<br>
ref.m:023: free,<br>
ref.m:023: free<br>
ref.m:023: )'.<br>
ref.m:028: In clause for `main(di, uo)':<br>
ref.m:028: in argument 1 of call to predicate `ref.f'/1:<br>
ref.m:028: mode error: variable `V_8' has instantiatedness `free',<br>
ref.m:028: expected instantiatedness was `bound(ref.a(ground, free))'.<br>
For more information, recompile with `-E'.<br>
<br>
Yes, I know from documentation, that "The current implementation does not handle partially instantiated data structures yet.". Is this the case?<br>
I just wonder then what's the use from those (modes, insts)-magic if all compound insts except for ground and free are hardly useful... Your clarification is greatly appreciated.<br>
Is there any probability that this feature will be implemented in near future?<br>
<br>
Btw, interesting... If I understand correctly strong typed Tubo Prolog supported this feature by means of reference domains, but in last version of Visual Prolog they have dropped this capability.<br>
<br>
Sincerely yours,<br>
Vladimir.<br>
</div></blockquote>
<br>
--------------------------------------------------------------------------<br>
mercury-users mailing list<br>
Post messages to: <a href="mailto:mercury-users@csse.unimelb.edu.au" target="_blank">mercury-users@csse.unimelb.edu.au</a><br>
Administrative Queries: <a href="mailto:owner-mercury-users@csse.unimelb.edu.au" target="_blank">owner-mercury-users@csse.unimelb.edu.au</a><br>
Subscriptions: <a href="mailto:mercury-users-request@csse.unimelb.edu.au" target="_blank">mercury-users-request@csse.unimelb.edu.au</a><br>
--------------------------------------------------------------------------<br>
</blockquote></div><br></div>