root/trunk/examples/engines/SCRIPT.txt

Revision 4662, 1.5 KB (checked in by pmoura, 5 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 loading the example:
13
14| ?- logtalk_load(engines(loader)).
15...
16
17
18% both cars provide the same interface, declared in the protocol
19% that is implemented by the categories imported by each object:
20
21| ?- sedan::current_predicate(P).
22
23P = reference/1 ;
24P = capacity/1 ;
25P = cylinders/2 ;
26P = horsepower_rpm/2 ;
27P = bore_stroke/2 ;
28P = fuel/1
29yes
30
31
32| ?- coupe::current_predicate(P).
33
34P = reference/1 ;
35P = capacity/1 ;
36P = cylinders/2 ;
37P = horsepower_rpm/2 ;
38P = bore_stroke/2 ;
39P = fuel/1 ;
40yes
41
42
43% the sedan engine properties are the ones defined in the corresponding
44% imported category (classic):
45
46| ?- sedan::(reference(Name), cylinders(Cylinders), horsepower_rpm(HP, RPM)).
47
48Name = 'M180.940'
49Cylinders = 6
50HP = 94
51RPM = 4800
52yes
53
54
55% the coupe engine properties are the ones defined in the corresponding
56% imported category (sport) plus the ones inherited from the top category
57% (classic) which are not overridden:
58
59| ?- coupe::(reference(Name), cylinders(Cylinders), horsepower_rpm(HP, RPM)).
60
61Name = 'M180.941'
62Cylinders = 6
63HP = 115
64RPM = 3657
65yes
Note: See TracBrowser for help on using the browser.