Re: ASSERT in SWI Prolog



Nick Wedd wrote:
In message <ebrnrb$deo$1@xxxxxxxxxxxxxxxx>, russell kym horsell <kym@xxxxxxxxxxxxxxxxxxx> writes

Mika <miky821@xxxxxxxx> wrote:

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".

It's not that ugly. Use bagof to collect all the facts into a list, 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.

Can't you imagine why anyone would wish to update
a large data structure without rewriting the entire
thing?!

Since the clauses of a functor *are* in a well-defined
order, and Prolog lets us exploit this (if we wish), it
could be useful (performance-wise) to be able to do this.

Indeed it seems inconsistent that we have asserta and
assertz but not a more general form. My guess is that
SWI-Prolog's database implementation is not amenable to
inserting any qty of clauses between two others, else
Jan would have added it by now :-)

More generally, it would be handy to be able to update
parts of a (large) fact in place...

Paul Singleton
.



Relevant Pages

  • Re: BizTalk 2004 :: Fact retriever :: more than 1 data connection?
    ... I tried executing the assert statement twice so that my rules policy can go ... Object facts, Object data, EngineState nextState) ... > connection being handed back. ...
    (microsoft.public.biztalk.general)
  • Re: The Tears Of Finding The Truth
    ... I know in some sense you do, because there's little factual room to disagree, even though you yourself like to deflect to 'HYPERETHNOCENTRISM' and the hatreds as living proof of...? ... And you provided nothing to assert, when I provided a small mountain of evidence and a forum for discussing what it means and entails. ... Your's was a flatus in a blizzard- a pile of not much of anything except your conclusion, which you just stated with no more facts than your own erroneous review, a faked one, taken from a one page reading from somewhere, that clearly shows this: you need to believe you are a giant. ... source and how it fits and then try to sell how I don't understand the causes, and all you had was hyperethnocentrism, and a few other flatulent self blame and blame of america, and it's you who are very very short of minimal study in the issues, the facts. ...
    (rec.martial-arts)
  • Re: BizTalk 2004 :: Fact retriever :: more than 1 data connection?
    ... > at Microsoft.RuleEngine.Rete.Rete.ExecuteInternal(Object facts, Object ... > object factsHndlOut = null; ... >> Simply create and assert more than one dataconnection. ... >> connection being handed back. ...
    (microsoft.public.biztalk.general)
  • Re: How to create a list of sharing variables?
    ... it was actually forbidden explicitly to use assert; ... stored the crossword in an array but as a number of facts field. ... also had the idea to transpose rows and columns but did it by replacing ... Given a general task, where the input consists of some objects (maybe of ...
    (comp.lang.prolog)
  • Re: IFactRetirever -- can we parameterize on already asserted fact
    ... long term facts, but not through the use of DataConnection. ... UpdateFacts method so that I can run the SQL query and populate my cache. ... data has been cached and assert it into the BRE without going to the database. ...
    (microsoft.public.biztalk.general)