以下のコードでは、最初に文字を読み込む方法を見つけたいと思います
(ユーザーが「3.」と入力してから
、その文字の数を listCharacters データベース から削除/撤回します)。
:- dynamic listCharacters/1.
listCharacters(Joe).
listCharacters(Tom).
listCharacters(Peter).
:- write_ln('Type in the name of the character you have from the below list.
Example "Tom" '), write_ln('1. Joe'), write_ln('2. Tom'), write_ln('3. Peter'),
read(X), retract(listOfCharacters(X)).