users-prolog
[Top][All Lists]
Advanced

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

Re: Dynamic Allocation seems to crash gprolog (follow-up)


From: Leonardo B. Lopes
Subject: Re: Dynamic Allocation seems to crash gprolog (follow-up)
Date: Fri, 14 Dec 2001 12:37:58 -0600 (CST)

Dear Daniel and Friends,

        This is an update on the message I sent earlier. I upgraded to
1.2.8 and the problem still persisted... I appreciate any help.

Thanks!
Leo.

On Fri, 14 Dec 2001, Daniel Diaz wrote:

> I Leonardo,
> 
> It is difficult to help you since 1) you dont give us a query that fails and 
> 2) we cannot even
> compile your program
> (areChildrenOf is not defined as an operator, thus line #12 has an error and 
> predicate
> areChildrenOf/2 nor printChildren/1 is defined).... Give us more info !
> 
> BTW the current stable version is 1.2.8 and fixes some bugs with dynamic 
> code. see
> http://gprolog.inria.fr for more information on how to download it...
> 
> 
> 
> "Leonardo B. Lopes" wrote:
> > 
> > Dear Friends:
> > 
> >         I have this little routine which does a search over special trees.
> > I would like to delete the tree once it is no longer useful, but this code
> > seems to crash gprolog. Is there something I'm doing wrong?
> > 
> > :- dynamic(parent/2,root/1,is_parent/2,is_root/1).
> > 
> > :- op(500,xfx,(is_parent)).
> > 
> > :- op(500,xfx,'has_children').
> > X has_children 0 :-     leaf(X).
> > X has_children Y :- setof(Children, X is_parent Children, Set),
> >                                         length(Set,Y).
> > 
> > printTree(X) :- write('$'),
> >                                 C areChildrenOf X,
> >                                 printChildren(C),
> >                                 write('^').
> > 
> > createBalancedTree([],_):- !.
> > createBalancedTree([RootDegree|DegreeList],Tree) :-
> >         new_atom(Tree),
> >         for(_,1,RootDegree),
> >                 createBalancedTree(DegreeList,Child),
> >                 asserta( Tree is_parent Child),
> >         Tree has_children RootDegree.
> > 
> > deleteTree(Tree) :-
> >         Tree is_parent X,
> >         retract(Tree is_parent X),
> >         deleteTree(X).
> > 
> > Also, any other trees previously defined also get deleted when I use
> > deleteTree. BTW, I'm using gprolog 1.2.1.
> > 
> > Appreciate any help!
> > Leo.
> > 
> > ========================================================================
> > Leonardo B. Lopes                                       address@hidden
> > Ph.D. Student                                              (847)491-8470
> > IEMS - Northwestern University              http://www.iems.nwu.edu/~leo
> > 
> 
> 
> -- 
> Daniel Diaz   address@hidden
> http://pauillac.inria.fr/~diaz
> gprolog --version 2>&1 | sed -n -e 's/By //p'
> 

========================================================================
Leonardo B. Lopes                                       address@hidden 
Ph.D. Student                                              (847)491-8470
IEMS - Northwestern University              http://www.iems.nwu.edu/~leo




reply via email to

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