Subject: RE: problems with asserta.

From: "Douglas Miles" <[email-masked]>
Date: Tue, 14 Nov 2000 13:00:04 -0800

Ed,

:-dynamic(fib/2).

 fib(1,1).
 fib(2,1).
 fib(N,F) :-
      N > 2,
      N1 is N - 1, fib(N1, F1),
      N2 is N - 2, fib(N2, F2),
      F is F1 + F2,
      asserta(fib(N,F)).
 
-Douglas

> -----Original Message-----
> From: Ed Kovach [mailto:[email-masked]]
> Sent: Tuesday, November 14, 2000 12:40 PM
> To: [email-masked]
> Subject: problems with asserta.
> 
> 
> Hi,
> 
> I am trying to use asserta,but  I keep getting an error.  Here is 
> an example
> of my problem.
> (The code to generate the fibonacci series.)
> 
> 
> fib(1,1).
> fib(2,1).
> fib(N,F) :-
>      N > 2,
>      N1 is N - 1, fib(N1, F1),
>      N2 is N - 2, fib(N2, F2),
>      F is F1 + F2,
>      asserta(fib(N,F)).
> 
> 
> 
> The message I get is
> 
> ERROR: No permission to modify static_procedure 'fib/2'
> ^ Exception: (14) asserta(fib(3,2)) ?
> 
> What am I doing wrong?  Thanks for your help!
> 
> Ed Kovach [email-masked]
> 
> 
> 
> 
> 
> ----------------
> * To UNSUBSCRIBE, please use the HTML form at
> 
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist
> 
> or send mail to [email-masked] using the Subject: 
> "unsubscribe"
> (without the quotes) and *no* message body.
> 
> ** An ARCHIVE of this list is maintained at
> 
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/
> 
> 
>