i don't understand 
Author Message
 i don't understand

        Hi ..

        I'm a user of Sicstus Prolog. I tried to do something like
        this :-
                drink(coke).
                :-retract(drink(coke)).

        The interpreter gives me this error message :

        PERMISSION ERROR: retract(user:drink(coke)) - cannot
        change static user:drink/1.

        Where did i go wrong ?

        Thanks
        Tan Poh Keam,
        DISCS, NUS



Sun, 04 Feb 1996 16:07:06 GMT  
 i don't understand


Second: Only dynamic predicates can be retracted in SICStus.  To make
a predicate dynamic you can either (1) assert a non existing predicate
or (2) declare the predicate as dynamic.  In your case I assume that
the loaded/compiled file should look something like this:

    :- dynamic drink/1.
    drink(coke).

Then you can compile it or load it with:

    ?- compile(file).  OR   ?- [file].

And retract the fact with:

    ?- retract(drink(coke)).

--
Roland Karlsson             SICS, PO Box 1263, S-164 28 KISTA, SWEDEN

Telex: 812 6154 7011 SICS   Ttx: 2401-812 6154 7011=SICS



Mon, 05 Feb 1996 18:32:19 GMT  
 i don't understand

Quote:
>    I'm a user of Sicstus Prolog. I tried to do something like
>    this :-
>            drink(coke).
>            :-retract(drink(coke)).

>    The interpreter gives me this error message :

>    PERMISSION ERROR: retract(user:drink(coke)) - cannot
>        change static user:drink/1.

>    Where did i go wrong ?

Add the declaration

:- dynamic(drink/1).

at the beginning.  This tells the compiler not to compile 'drink(coke)'
but rather to keep it in a form that can be recognized and removed at
run time.

--
:-  Michael A. Covington, Associate Research Scientist        :    *****

:-  The University of Georgia              phone 706 542-0358 :   *  *  *
:-  Athens, Georgia 30602-7415 U.S.A.     amateur radio N4TMI :  ** *** **  <><



Tue, 06 Feb 1996 01:55:56 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. don't understand cause of `sysread': Bad file descriptor (Errno::EBADF)

2. Reports - Error message I don't understand

3. ordcreate with DBFCDX, don't understand

4. Don't understand exception trace

5. I don't understand why my haskell program works

6. I don't understand this

7. Something I don't understand about bindings

8. Don't Understand this Dr. Scheme Answer

9. HELP!I don't understand an assembly source code

10. Learning assy: I don't understand concept of CBW instruction

11. I don't understand tables and arrays

12. don't understand packages vs. objects/classes

 

 
Powered by phpBB® Forum Software