Re: strange behaviour



Erik Braun <qs206710n5sqn8r56s6pr3s980940ss3@xxxxxxxxxxxxxxxxx> wrote:
} I do not understand the following behaviour. The first call of "prove" fails
} until the command to be proven is called for itself. Then "prove" is
} successful.
} I have no idea if this is intended behaviour and if is so, why the results
} happen. I use the SWI-Prolog, which is shipped with SuSE Linux 10.0.

} $ cat meta.pl
} prove(true).
} prove((A,B)) :- prove(A), prove(B).
} prove(A) :- clause(A,B), prove(B).
} $ pl -s meta.pl
} % meta.pl compiled 0.00 sec, 672 bytes
} Welcome to SWI-Prolog (Multi-threaded, Version 5.5.27)
} [...]
} ?- trace,prove(append([],[],[])).
} Call: (8) prove(append([], [], [])) ? creep
} ^ Call: (9) clause(append([], [], []), _L198) ? creep
} ^ Fail: (9) clause(append([], [], []), _L198) ? creep
[...]



Right. Append has no clauses -- it's normally a builtin. You'll have
to provide for builtins in your meta-interp or define an appropriate
append with clause(s:).
.



Relevant Pages

  • Re: Fastest way to convert 1000s of YYYYMMDD char dates to real dates?
    ... that dates are stored in tables in YYYYMMDD format, ... strictdate 0 builtin. ... Your append from text takes advantage of that. ...
    (microsoft.public.fox.programmer.exchange)
  • in place-ness of list.append
    ... I would like to find out of a good way to append an element to a list ... without chaing that list in place, like the builtin list.appenddoes. ... "Someday I'll write my own philosophy book." ...
    (comp.lang.python)