:- dynamic(f/0).

test :- f, write('not the first time').
test :- \+ f, asserta(f), write('the first time').

:- write('To start this program, type ''test.''.').
:- reconsult('capitals.pl').