root/trunk/examples/modules/SCRIPT.txt

Revision 4662, 1.2 KB (checked in by pmoura, 6 days ago)

Updated copyright notice.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1================================================================
2Logtalk - Open source object-oriented logic programming language
3Release 2.35.0
4
5Copyright (c) 1998-2009 Paulo Moura.        All Rights Reserved.
6Logtalk is free software.  You can redistribute it and/or modify
7it under the terms of the "Artistic License 2.0" as published by
8The Perl Foundation. Consult the "LICENSE.txt" file for details.
9================================================================
10
11
12% start by compiling and loading the Prolog module files as objects:
13
14| ?- logtalk_load(modules(loader)).
15...
16
17
18% call one of the module exported predicates using message sending:
19
20| ?- test::names.
21
22paulo
23carlos
24helena
25yes
26
27
28% same goal as above but the call is made using a meta-predicate
29% imported from other module:
30
31| ?- test::test.
32
33paulo
34carlos
35helena
36yes
37
38
39% test the compilation of the module export/1 directive; module
40% exported predicates become public predicates:
41
42| ?- exports::current_predicate(Pred).
43
44Pred = p/1
45yes
46
47| ?- exports::predicate_property(p(_), Prop).
48
49Prop = public ;
50Prop = static ;
51Prop = declared_in(exports) ;
52Prop = defined_in(exports)
53yes
54
55
56% call the module exported/public predicate using message sending:
57
58| ?- exports::p(N).
59
60N = 1 ;
61N = 2 ;
62N = 3
63yes
Note: See TracBrowser for help on using the browser.