Logtalk 2.27.0 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1539 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
13
Logtalk/examples/expansion/NOTES
Normal file
13
Logtalk/examples/expansion/NOTES
Normal file
@@ -0,0 +1,13 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.27.0
|
||||
|
||||
Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
||||
|
||||
To load this example and for sample queries, please see the SCRIPT
|
||||
file.
|
||||
|
||||
For a description of this example, please see the comments in the
|
||||
engines.lgt source file.
|
45
Logtalk/examples/expansion/SCRIPT
Normal file
45
Logtalk/examples/expansion/SCRIPT
Normal file
@@ -0,0 +1,45 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.27.0
|
||||
|
||||
Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
||||
|
||||
% start by loading the example:
|
||||
|
||||
| ?- logtalk_load([library(term_expansionp), expansion(loader)]).
|
||||
...
|
||||
|
||||
|
||||
% simple tests of the expand_term/2 built-in method:
|
||||
|
||||
| ?- exp_public::expand_term(8, Term).
|
||||
|
||||
Term = eight
|
||||
yes
|
||||
|
||||
| ?- exp_protected::expand_term(8, Term).
|
||||
|
||||
Term = 8
|
||||
yes
|
||||
|
||||
| ?- exp_private::expand_term(8, Term).
|
||||
|
||||
Term = 8
|
||||
yes
|
||||
|
||||
| ?- desc_public::test(8, Term).
|
||||
|
||||
Term = eight
|
||||
yes
|
||||
|
||||
| ?- desc_protected::test(8, Term).
|
||||
|
||||
Term = eight
|
||||
yes
|
||||
|
||||
| ?- desc_private::test(8, Term).
|
||||
|
||||
Term = 8
|
||||
yes
|
65
Logtalk/examples/expansion/expansion.lgt
Normal file
65
Logtalk/examples/expansion/expansion.lgt
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
:- category(number_conversion,
|
||||
implements(term_expansionp)).
|
||||
|
||||
term_expansion(0, zero).
|
||||
term_expansion(1, one).
|
||||
term_expansion(2, two).
|
||||
term_expansion(3, three).
|
||||
term_expansion(4, four).
|
||||
term_expansion(5, five).
|
||||
term_expansion(6, six).
|
||||
term_expansion(7, seven).
|
||||
term_expansion(8, eight).
|
||||
term_expansion(9, nine).
|
||||
|
||||
:- end_category.
|
||||
|
||||
|
||||
:- category(conversion_test).
|
||||
|
||||
:- public(test/2).
|
||||
|
||||
test(Term, Expansion) :-
|
||||
expand_term(Term, Expansion).
|
||||
|
||||
:- end_category.
|
||||
|
||||
|
||||
:- object(exp_public,
|
||||
imports(public::number_conversion)).
|
||||
|
||||
:- end_object.
|
||||
|
||||
|
||||
:- object(desc_public,
|
||||
imports(conversion_test),
|
||||
extends(exp_public)).
|
||||
|
||||
:- end_object.
|
||||
|
||||
|
||||
:- object(exp_protected,
|
||||
imports(protected::number_conversion)).
|
||||
|
||||
:- end_object.
|
||||
|
||||
|
||||
:- object(desc_protected,
|
||||
imports(conversion_test),
|
||||
extends(exp_protected)).
|
||||
|
||||
:- end_object.
|
||||
|
||||
|
||||
:- object(exp_private,
|
||||
imports(private::number_conversion)).
|
||||
|
||||
:- end_object.
|
||||
|
||||
|
||||
:- object(desc_private,
|
||||
imports(conversion_test),
|
||||
extends(exp_private)).
|
||||
|
||||
:- end_object.
|
9
Logtalk/examples/expansion/loader.lgt
Normal file
9
Logtalk/examples/expansion/loader.lgt
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
:- initialization(logtalk_load(expansion)).
|
||||
|
||||
/*
|
||||
If you intend to use the FOP XSL:FO processor for generating PDF documenting
|
||||
files, comment the directive above and uncomment the directive below
|
||||
|
||||
:- initialization(logtalk_load(expansion, [xmlsref(standalone)])).
|
||||
*/
|
Reference in New Issue
Block a user