This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/Logtalk/examples/points/point_history.lgt
pmoura 75392e54c7 Logtalk 2.15.0 release files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@757 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2003-02-05 00:15:28 +00:00

52 lines
961 B
Plaintext

:- category(point_history).
:- info([
version is 1.0,
date is 1998/3/23,
author is 'Paulo Moura',
comment is 'Point position history management predicates.',
source is 'Example adopted from the SICStus Objects documentation.']).
:- public(add_to_history/1).
:- mode(add_to_history(+nonvar), one).
:- public(init_history/1).
:- mode(init_history(+list), one).
:- public(history/1).
:- mode(history(-list), zero_or_one).
:- public(print_history/0).
:- mode(print_history, zero_or_one).
:- private(history_/1).
:- dynamic(history_/1).
:- mode(history_(-list), zero_or_one).
add_to_history(Location) :-
::retract(history_(History)),
::assertz(history_([Location| History])).
init_history(History) :-
::retractall(history_(_)),
::assertz(history_(History)).
history(History) :-
::history_(History).
print_history :-
::history_(History),
write('location history: '),
write(History),
nl.
:- end_category.