Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!ukc!etive!lfcs!jha From: jha@lfcs.ed.ac.uk (Jamie Andrews) Newsgroups: comp.lang.prolog Subject: Re: Committed Choice Keywords: cut if-then-else Garbage on the stacks Message-ID: <1717@etive.ed.ac.uk> Date: 7 Apr 89 08:47:58 GMT References: <11500012@hpldola.HP.COM> <733@gould.doc.ic.ac.uk> <18798@adm.BRL.MIL> <192@aucsv.UUCP> <751@gould.doc.ic.ac.uk> <674@tuvie> Sender: news@etive.ed.ac.uk Reply-To: jha@lfcs.ed.ac.uk (Jamie Andrews) Organization: Laboratory for the Foundations of Computer Science, Edinburgh U Lines: 14 In article <674@tuvie> ulrich@vip.UUCP (Ulrich Neumerkel) writes: >blam(0,[]). >blam(N,[L|L]) :- N > 0, M is N - 1, blam(M,L). > >..., blam(32,L), assert(little_fact(L)),... I think most Prolog implementations would do this sensibly, representing this as 32 cons cells with both pointers pointing to the next element on the list, and the last cell pointing to the null list. There seems to be no reason for copying at all -- [L|L] creates one cons cell. Or am I missing something? --Jamie. jha@lfcs.ed.ac.uk