My take:
Many good prolog predicates are of the form abc_def(Abc, Def), where the idea is that abc and def are corresponding concepts. This is particularly so in introductory examples like parent, sibling, and ancestor.
So naturally when it comes to predicates, I also think head_body(add(X,Y,Z), Z is X + Y). Therefore the natural-feeling predicates are
record_head_body(Head, Body)
delete_head_body(Head, Body)
lookup_head_body(Head, Body)
These sort the ideas I feel are behind assert, retract, and clause, and that is why assert seems to want 2 arguments.
Alan Baljeu
----- Original Message ----
From: Richard O'Keefe <
ok@...>
To: Günter Kniesel <
gk@...>
Cc: SWI-Prolog mailing list <
swi-prolog@...>
Sent: Sunday, June 28, 2009 9:51:15 PM
Subject: Re: [SWIPL] Inconsistent behaviour of assert/2
On Jun 28, 2009, at 6:20 AM, Günter Kniesel wrote:
> 17 ?- assert(a,b).
> false.
>
> 18 ?- listing(a).
> :- dynamic user:a/0.
>
> user:a.
>
> true.
For what it's worth, I tried this in two other Prolog
systems and got the same result.
What really puzzles me is why the students came up with
this misconception in the first place. I mean, they'd have
seen examples of assert/1, but not examples of assert/2.
PLT Scheme has an interesting approach. They've divided
the language into levels, and the initial teaching level
doesn't have very much. You have to explicitly move to
a richer level. If you are an expert coming to PLT Scheme
for the first time, expecting everything you know to be there,
it's a nuisance, but it sounds like a good way to protect
beginners from (some) accidents.
_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now
http://ca.toolbar.yahoo.com.
_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog