[comp.lang.prolog] "Unbinding" in Prolog

ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) (06/18/91)

In article <421@daily-planet.concordia.ca>, mitch@cs.concordia.ca (Mitch Cherniack) writes:
> Is it possible to "unbind" variables without backtracking?

No.

> 	filter(OldTable,NewTable) :- ...
> 	
> Thus each filter binds a new table to a new variable (NewTable), and
> since the OldTable stays in memory, I am finding that I quickly run
> out of memory.

Er, that really shouldn't be a problem.  The binding of OldTable should only
hang around if the OldTable variable might still be reference.  A likely
cause of the problem is that your code is not ``obviously'' determinate.
We can't possinbly tell without seeing more of your code.

> What I really would like to do is to "lose" the old
> binding of OldTable and rebind the new table to OldTable.  In other 
> words, I want an assignment statement in my Prolog.

Tell you what, why don't you just use Pascal?  I'm serious.  If you
want assignment statements, you know where to find the.  All you need
to do to lose the old binding of OldTable and have the space reclaimed
is to make sure it can't be reached any more.  I write code like what
you've shown all the time, and it just isn't a problem, the space IS
reclaimed.

> For what it is worth, I am using BNR Prolog v.2.0 for the  Macintosh.

It's worth a lot, because BNR Prolog was, hmm, innovative.  When I last
saw a manual, the bodies of clauses were lists, for example.  We really
need to see more of your code.

-- 
Q:  What should I know about quicksort?   A:  That it is *slow*.
Q:  When should I use it?  A:  When you have only 256 words of main storage.