users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help- error in executing "retract" predicate


From: Vic Bancroft
Subject: Re: Help- error in executing "retract" predicate
Date: Wed, 27 Feb 2002 18:21:39 -0500 (EST)

You may also want to use the initialization/1 predicate to set up your 
dynamic predicates.  For example, given a file, vidhya.pl, containing,

  :- dynamic( sam/1 ).
  
  :- initialization( assertz( sam( 1 ) ) ).
  
  soln :-
    sam(X),
    retract(sam(X)),
    write(success).
  
when consulted, in the following behavior,

  | ?- [vidhya].
  compiling /home/bancroft/src/prolog/vidhya.pl for byte code...
  /home/bancroft/src/prolog/vidhya.pl compiled, 9 lines read - 583 bytes 
written, 63 ms
  
  (10 ms) yes
  | ?- listing.
  
  sam(1).
  
  soln :-
        sam(A),
        retract(sam(A)),
        write(success).
  
  yes
  | ?- soln.
  success
  
  yes
  | ?- listing.
  
  
  soln :-
        sam(A),
        retract(sam(A)),
        write(success).
  
  yes
  
more,
l8r,
v

-- 
katabatic cohabitation :  to live together as if a married couple or in 
company;  
to exist together, relating as or being like a wind produced by the flow of 
cold 
dense air down a slope (as of a mountain or glacier) in an area subject to 
radiational cooling.   mailto:address@hidden  http://america.net/~bancroft




reply via email to

[Prev in Thread] Current Thread [Next in Thread]