"Prolog"
namespace.
"Prolog::PrologInterpreter"
, and
Prolog::PrologInterpreter open
Evaluate solutions (no user interaction):
|string prolog result answerSet actionInvokedForResult|
answerSet := Set new.
actionInvokedForResult := [:answer | answerSet add:answer. true].
string := '
?- remove. % remove all predicates in PrologDataBase.
likes(john,mary). % assert fact.
likes(john,wine). % assert fact.
likes(mary,wine). % assert fact.
likes(mary,john). % assert fact.
?- likes(X,Y). % question goal.
?- likes(john,X), likes(mary,X). % question goal.
'.
prolog := Prolog::PrologInterpreter new.
prolog textCollector: Transcript.
result := prolog
refute:string action:actionInvokedForResult.
answerSet inspect
With user interation:
|string prolog result actionInvokedForResult|
actionInvokedForResult := Prolog::PrologInterpreter exampleActionFor:prolog.
string := '
?- remove. % remove all predicates in PrologDataBase.
likes(john,mary). % assert fact.
likes(john,wine). % assert fact.
likes(mary,wine). % assert fact.
likes(mary,john). % assert fact.
?- likes(X,Y). % question goal.
?- likes(john,X), likes(mary,X). % question goal.
'.
prolog := Prolog::PrologInterpreter new.
prolog textCollector: Transcript.
result := prolog
refute:string action:actionInvokedForResult.
Legally, it is a freeware or public domain goody, as specified in the goodies copyright notice (see the goodies source).
Copyright (C) 1995-1997 AOKI Atsushi
Atsushi Aoki,
Software Research Associates, Inc.
1113 Spruce Street, Suite 502
Boulder, Colorado 80302 the U.S.A.
<info@exept.de>