Article View: comp.lang.prolog
Article #3998Re: Committed Choice
From: Jamie Andrews
Date: Fri, 07 Apr 1989 08:47
Date: Fri, 07 Apr 1989 08:47
14 lines
1166 bytes
1166 bytes
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
Technical Details
Message-ID:
<1717@etive.ed.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!ukc!etive!lfcs!jhaReferences:
<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>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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