[Top][All Lists]
[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: |
Wed, 16 Jul 2003 20:49:44 +0200 |
Manuel Carro wrote:
>> Well, without knowing exactly what you are trying to
>> accomplish with recursion, may I venture to suggest that
>> you replace the recursive loop with a repeat-fail type loop
>> (using accumulator variables to store results over
>> backtracking)? Here you get garbage collection for free.
>> You'll find a number of examples on my website:
> Accumulator variables won't help you on backtracking.
> Maybe you mean dynamic predicates? Which example were you
> referring to?
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.
Hope this helps.
Daniel
- Iteratively calling Prolog from C, Daniele Peri, 2003/07/02
- Re: Iteratively calling Prolog from C, Lindsey Spratt, 2003/07/16
- Re: Iteratively calling Prolog from C, Daniele Peri, 2003/07/16
- Re: Iteratively calling Prolog from C, Daniel Dudley, 2003/07/16
- Re: Iteratively calling Prolog from C, Manuel Carro, 2003/07/18
- Re: Iteratively calling Prolog from C,
Daniel Dudley <=
- Re: Iteratively calling Prolog from C, Daniele Peri, 2003/07/17
- A note of belated politeness., tvetunge, 2003/07/17
- Re: Iteratively calling Prolog from C, Daniel Dudley, 2003/07/17
- Re: Iteratively calling Prolog from C, Daniele Peri, 2003/07/17
- Re: Iteratively calling Prolog from C, Daniel Dudley, 2003/07/17
- Re: Iteratively calling Prolog from C, Daniel Dudley, 2003/07/17
- Re: Iteratively calling Prolog from C, Daniel Dudley, 2003/07/17
- Re: Iteratively calling Prolog from C, Lindsey Spratt, 2003/07/17
- Re: Iteratively calling Prolog from C, Daniel Dudley, 2003/07/17
- Re: Iteratively calling Prolog from C, Lindsey Spratt, 2003/07/17