Re: Out of local stack? (SWI)
From: djamé (djame_at_biensur.com)
Date: 01/14/04
- Previous message: Simon Helsen: "GPCE 2004 First Call for Papers"
- In reply to: seguso: "Re: Out of local stack? (SWI)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 14 Jan 2004 23:36:55 +0100
I've loooked in your code too and what you should consider is to check
that your clauses go from the most spécific case to the most général
one......rembember, order is very important in prolog (that's why peolpe
who are coming from a imperative language love the
( test = x ->
do_x
; test=y ->
do_y
; test = z ->
do_z
; % default
do_defaults
). % I know I should add all the parenthesis but I'm tired now....
in fact, maybe the first clause can match too much stuff....... so the
use of the cut is justified if you consider that you have to check one
and only one choice, so in order to debug maybe you shoulde add a cut to
all the lines 'Ontimer" and see wich one is always choosen.....
Djamé
ps to respond : my email is djame.seddah@NOSPAM.loria.fr
seguso wrote:
> Il Thu, 01 Jan 2004 18:25:18 +0000, Jan Wielemaker ha scritto:
>
>
>>This predicate should either be written using if-then-else style
>>or after passing the conditions for the clause there should be a cut.
>>Remember you only get last-call optimisation if *Prolog* understands there
>>are no choicepoints, not if *you* can prove there is only one solution
>>and standard Prolog is pretty simple minded.
>
>
> Thanks a lot for the lesson. That theory is just what I needed (and I
> have no idea where I could find it).
>
> I was assuming that tail-recursion was sufficient in order to have
> last-call optimization... I am beginning to realize I don't have a good
> background in prolog, only your reference manual :-)
>
>
>>P.s. The screendumps of segusoland look nice!
>
>
> Thanks! So the choice of using GTK was a good one. Looks are important
> nowadays.
>
> ---
>
> Many have told me "What? it is not in C? too bad, I would have been
> willing to help you if it were..."
>
> If i converted it to C I would have a huge list of helpers...
>
> But I know at least two persons who are studying prolog because of my
> program. :-)
>
- Previous message: Simon Helsen: "GPCE 2004 First Call for Papers"
- In reply to: seguso: "Re: Out of local stack? (SWI)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|