Re: [eclipse-clp-users] [SWI-Prolog/swipl-devel] user-data-type-attvars (#189)

From: Douglas Miles <logicmoo_at_...6...>
Date: Fri, 6 Jan 2017 14:46:07 -0800
​Thank you ​Kish


On Fri, Jan 6, 2017 at 1:39 PM, Kish Shen <kish.shen_at_...6...> wrote:

> Hi Douglas,
>
> I assume you are posting this question about ECLiPSe, rather than
> SWI-Prolog, as your title seem to suggest.
>

Right oops I forget to change the subject to ECLiPSe



>
> To unify V1=V2
>
> ...
>
>>   Could V1 and V2 still be different variables?
>
>
> No. Once you unify 2 terms, they become the same, i.e. V1 and V2 represent
> the same variable after unification, and there is only one attribute for
> the variable. This is a fundamental property of unification in Prolog.
>
>>  get a wakeup to decide the my_string_words were a okay to unify
>
>
> User defined unification handlers (one per attribute)  is invoked when a
> attributed variables are unifiied. The handler should define the
> unification behaviour for the attribute, for example, how to merge the two
> original attributes into the single attribute after unification.
>

​Yeah, i see I may rescue some of the attributes off the variable that is
about to disappear.


> There is a chapter on attributed variables in the user manual:
>
> http://eclipseclp.org/doc/userman/umsroot093.html
>
> which I strongly recommend you to consult if you haven't done so.
>
> On a more general point:
>
> >I would like believe that I can use attvars/metaterms to proxy for
> complex datatypes.
>
> This is not what attributed variables are designed for. I think you should
> use normal Prolog (variables and data structures) to implement your string
> type, rather than trying to push them into an attribute.
>

Designed for implementing constraints as people say.

​Thank you!
Douglas​
Received on Fri Jan 06 2017 - 22:46:29 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:21 CEST