Re: [eclipse-clp-users] Variable Attribute

From: Joachim Schimpf <jschimpf_at_coninfer.com>
Date: Mon, 28 Nov 2016 09:52:34 +0000
On 28/11/16 04:44, Edgaonkar, Shrirang wrote:
> Dear clp users,
>
>   I am using variable attribute for some logic. To isolate my problem I have
> mentioned the below script.
>
> :- lib(ic).
> :- lib(ic_kernel).
>
> has_my_attribute(_{eclipse:Attr}) ?-
>      nonvar(Attr),writeln(Attr).
>
> The script does not compile and gives me an error:-
>
> undefined variable attribute in add_attribute(_1841, Attr, eclipse)
>
> The error is valid when the we add an attribute without the meta_attribute/2 to
> declare the attribute.  But in my case, has_my_attribute is a predicate
> declaration and should not have the error.

Your code is ok, but you must first declare the attribute name
with meta_attribute/2.  So, in the simplest case:

:- meta_attribute(my_attribute, []).

has_my_attribute(_{my_attribute:Attr}) ?-
     nonvar(Attr).



-- Joachim
Received on Mon Nov 28 2016 - 09:52:41 CET

This archive was generated by hypermail 2.2.0 : Mon Jan 02 2017 - 12:13:19 CET