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: Bartek Wilczynski
Subject: Re: Iteratively calling Prolog from C
Date: Thu, 17 Jul 2003 18:58:47 +0200
User-agent: Internet Messaging Program (IMP) 3.0


Quoting Daniel Dudley <address@hidden>:

<cut>
 
> ?- factorial(18795, F).

<cut> 

> Big enough for you?
> 
> Daniel
> 

I'm afraid You don't understand the problem with tail recursion optimization,
and I think that other discussion participants find it to obvious to explain to
You, so I'll try. 

The problem of recursion optimization is usually caused not by the time
overhead, but by the memory usage on the stack. 18000 recursive calls is not
much. The problem begins when you try to somehow create a list of let's say
100.000.000 atoms using a recursive call. The list itself doesn't take you too
much memory, but the stack is overfilled with the recursive calls. 

Tail recursion optimization tries to help you with it, but unfortunately it's
not implemented well in gprolog (to my best knowledge).

And please, stop giving examples using different prolog implementation, when
discussion is about specific problems in gprolog implementation (or
not-implementation ;).

-- 
regards
   Bartek WilczyƱski





reply via email to

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