users-prolog
[Top][All Lists]
Advanced

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

Re: Iteratively calling Prolog from C


From: Daniel Dudley
Subject: Re: Iteratively calling Prolog from C
Date: Thu, 17 Jul 2003 14:30:42 +0200

Manuel Carro wrote:

>> Well, I call them "accumulator" variables, although there
>> may be a better way to describe them. Factorial_nd is the
>> simplest example, I believe. Notice how the last
>> two variables in factorial_nd/5 are used to store values
>> over backtracking. Otherwise, the same principle is used in
>> fib_qmat_nd.pl, fib_range_nd.pl, and magic_sq.pl.

>    These are accumulator variables, that name has been around
> for tenths of years.

Nice to know I got something right! :-) Tens of years might
be more correct, though.

> But you are not storing values over
> backtracking. When you backtrack to a choicepoint in the
> computation you have the same variable values as when that
> choicepoint was first created.

Hmm, you're picking at straws. ;-) Points to be aware of
would be that one is repeatedly calling (via backtracking)
a non-deterministic predicate, which has only one level of
recursion and one choice point at any one time.

Daniel




reply via email to

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