Assert in swish

Helping a student build an address book in swish.

:- dynamic addr/2.

check(N, A) :- addr(N,A).
add(N,A) :- writeln(N),assert(addr(N,A)).
del(N,A) :- retractall(addr(N,A)).

query add/2
then query check/2
false.

query
add(bob, road1),check(N,A).
works

The semantics of assert are borked. Is it now making a new pengine each time?

Every query in SWISH creates its isolated environment. That is one of the beauties and has always been like that. Only if you configured SWISH without sandbox you can assert in a permanent module and escape this restriction.

crazy teachers give students problems that use lots of assert/retract, and they come to me confused.