Re: ASSERT in SWI Prolog
- From: russell kym horsell <kym@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 17 Aug 2006 07:28:00 +0000 (UTC)
Nick Wedd <nick@xxxxxxxxxxxxx> wrote:
In message <ebrnrb$deo$1@xxxxxxxxxxxxxxxx>, russell kym horsell
<kym@xxxxxxxxxxxxxxxxxxx> writes
Mika <miky821@xxxxxxxx> wrote:It's not that ugly. Use bagof to collect all the facts into a list,
I want to know if this can be made in SWI Prolog.OK. The answer is "yes".
The answer to the question "is it pretty?", is -- of course -- "no".
process the list to replace fact2 by fact6, retractall the facts, and
then assert the facts in the list. Though I can't imagine why anyone
would want to do this.
I was thinking FAR uglier. :)
I'm not sure bagof guarantees always to return the facts in the same
order asserted. Maybe on some implementations it could return them in
reverse order, for example.
But, yes, I was thinking along the same lines, with some partial evaluation
thrown in. ;)
.
- References:
- ASSERT in SWI Prolog
- From: Mika
- Re: ASSERT in SWI Prolog
- From: A . L .
- Re: ASSERT in SWI Prolog
- From: Mika
- Re: ASSERT in SWI Prolog
- From: russell kym horsell
- Re: ASSERT in SWI Prolog
- From: Nick Wedd
- ASSERT in SWI Prolog
- Prev by Date: comp.lang.prolog Frequently Asked Questions
- Next by Date: Re: ASSERT in SWI Prolog
- Previous by thread: Re: ASSERT in SWI Prolog
- Next by thread: Re: ASSERT in SWI Prolog
- Index(es):