Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.cplire.ru/Lab144/start/e_hello.html
Дата изменения: Mon Sep 24 15:02:27 2007 Дата индексирования: Tue Oct 2 01:44:49 2012 Кодировка: Поисковые слова: п п п п п п п п п п п п п п п п п п п п п |
Actor Prolog is an object-oriented logic language. So, any program written in Actor Prolog consists of classes. Each class has a name. Every class includes some slots and clauses. Let us consider the first example (see the Hello.A file). Example. The Hello World program.------------------------------------------- -- An example of Actor Prolog program. -- -- (c) 2002, Alexei A. Morozov, IRE RAS. -- ------------------------------------------- project: (('Hello')) class 'Hello' specializing 'Console': [ goal:- writeln("Hello World!"). ] This program consists of solely 'Hello' class. The 'Hello' class includes one goal clause. It is only one writeln sub-goal in the clause. According to the semantics of Actor Prolog, during a creation of every instance of a class the goal predicate is called automatically in this instance of the class. Thus, when the instance of the 'Hello' class is created, the goal predicate runs. This predicate writes the "Hello World!" message. The creation of an instance of a class (the "world") is fulfilled by proving some constructor of the class instance. Constructors are special expressions containing a name of a class, enclosed in the round brackets. The use of the double round brackets designates constructors of processes. An instance of a class, created with the help of a constructor of a process, is a separate process of the program. That is, it will be executed concurrently with the respect to other processes. A constructor of a process is placed in the first line of the example program. This constructor defines an instance of the 'Hello' class. The instance of the class is declared as the goal statement of the program with the help of the project keyword. Thus, the execution of the program starts with the creation of an instance of the 'Hello' class. In the course of this operation the goal predicate will automatically run. This predicate will write the necessary message on the screen. Note that the 'Hello' class is declared as a descendant of the 'Console' predefined class containing some useful read/write predicates, with the help of the specializing keyword. One of these predicates is the writeln predicate used in the program.
Expand the panel of the player with the help of the |
Fig. 1. Reduced panel of the player.
Then press the |
Fig. 2. Load of the program.
Here is the output of the program: |
Fig. 3. The output of the program.
The functions of player buttons are the following:
Note that the player uses the following file extensions:
Good luck! |
![]() |
Table of content |
![]() |