CLACL
Paradigm | Logic programming |
---|---|
Designed by | Mauro Gazzelloni |
Developer | Mauro Gazzelloni |
First appeared | January 2000 |
Stable release |
1.04
/ April 2013 |
Implementation language | C++ |
OS | Microsoft Windows |
License | proprietary software |
Website | Project Site |
Influenced by | |
Prolog, C |
CLACL, representing CLAC-Language (where CLAC stands for Logical Composition with the Assistance of Computers) is the result of ongoing theoretical research which aims to provide a formal description of the logical choices relating to the definition of organizational processes of composition.
The logic of CLACL is based on 'spatial-relational' information rather than on the processing of numerical information. It generates a logical configuration and, with a tool called Plasma, shapes the created domain in a physical form such as music or graphics.
CLACL is a computing language that integrates into a production environment to provide several tools to facilitate writing code and representing it graphically.
The first version (00.02.00) of the language was made available to the Internet in 2000 at the project site. The version 00.06.00 was distributed at the 2009 Festival of Mathematics held in Rome, during which the project CLAC was presented.
Characteristics of the Language
The target users of the language are those who work within creative fields, including design and music.
Every design produces an organism, in which all its parts are related to create a complex and complete whole. For a better understanding, let us consider the graphic planning that is the design and realization of a graphic pattern. Those who have had a chance to prepare a composition know that every element should be in precise relation with the others, and only when all of the elements are balanced will the composition be considered complete. This process can be proven and verified.
Since the composition process is guided by logical choice, the program is centered on the information science of Artificial Intelligence. It is for this reason that the project is mentioned in the entry Computational creativity External_links in Wikipedia, as one of the few examples of the application of Information Science to Creativity.
The closely logic-driven syntax, somewhat challenging for anyone not accustomed to working in the field of Artificial Intelligence (AI), was supplemented by constructs more readily usable in practice.
As an example, see the description of a cycle (loop) implemented in Prolog and CLACL.
With the following example in prolog, a loop is a run that prints the loop index:
loop(X,Y) :-
!,X < Y,
print(X),
X2 is X + 1,
loop(X2,Y).
In CLACL, a similar process is carried out using the following code:
@PRINT("$x $y",NL) FOR ( $x, $y ) IN II[] { @PRINT($x,$y,NL) }
result:
$x $y !a !a !a !b !a !c !b !a !b !b !b !c !c !a !c !b !c !c
The formation of the cycle in CLACL is carried out in a very similar way to the C-Language. The language adopts a combination of the declarative and procedural paradigms. The two languages are Prolog and C-Language. The declarative aspect comes from Prolog, and is used in statements and in scanning the tree of alternatives (backtracking). The procedural aspect is derived from C-Language, and is highlighted in particular in the control structures of the procedural flow.
Structure of the language
The commands are listed in a script, that is subjected to an interpreter that generates the result. The purpose of carrying out command controls is to produce a logical configuration of entities, and represent them in graphic form and, as a product of processing, it will generate a grapj. The set of entities that form part of the graph are called a domain.
CLACL has three groups of statements:
- Declarations
- Controls
- Commands
The declarations reflect the situations of the domain and are the most similar to Prolog.
The controls implement constructs for controlling the flow of the code with loops and expressions.
The commands require or set conditions on the domain.
As with all programming languages, CLACL implements the following key concepts:
- Variable
- Instruction
- Expression
- Control structures
- Subprogram
- Information structures
In addition CLACL will also implement specialist concepts of the domain and of the issues which address:
- Statements
- Tests
- States
- Comments
The entities that can be generated via the interpretation of the script are:
- Instance
- An instance can be seen as a geometric point in the plane, but we are not interested in its position; our interest is its existence within the domain and its relationship with other entities.
- Relation
- A relation describes the relationship between different instances.
- Model
- A model allows the description of complex relations.
- Shape
- The shape describes the characteristics of a logical figure."
- Figure
- A logical figure can be seen as a geometrical figure.
|
Examples
Generation of an instance:
instance:a
or
!a
Generation of a relation:
relation:rl1(instance:a, instance:b)
or:
&rl1(!a, !b)
Definition of a model that represents a triangular configuration:
define model: tris(!a,!b,!c) { &rr(!a,!b) &rr(!b,!c) &rr(!c,!a) }
Implementation of a cycle:
FOR ($a$,b) in SET[] { @PRINT(“Instances “,$a,“ - “,$b,NL) }
Implementation of a condition:
CASE ($x == 0) { @PRINT(“The value of $x is zero“,NL) }
Definition of a function:
define function: switch($a$,b$,c) { CASE ($a == 1) { @PRINT($b,” - “,$c,NL) } CASE ($a == 2) { @PRINT($c,” - “,$b,NL) } }
Some operations on the set:
def INSI1[4] // definition of the set of 4 items
ST1[] = [ ST1[] + ST2[] ] // add
ST1[] = [ ST1[] - ST2[] ] // subtract
( ST1[] == ST2[] ) // equals
Example of a logic expression:
(( ST1[] == ST2[] ) AND (( ST3[] == ST2[] ) OR ( ST4[] == ST1[] )) AND pos(!a == !b))
Hypothesis about the project by Michelangelo
The design of the Piazza del Campidoglio by Michelangelo has not survived. The project is based on drawings made at second hand. With CLACL was made a compositional hypothesis on a new basis.
Spatial Expression Example
!a !b model:modSquare4(!a,!b,!c,!d) #f=shape:frmSquare4(!a,!b,!c,!d) I[]=cloud(!a,UNIFORM,100,1)
@GRFILL(Red) FOR ($x) IN I[] { CASE(pos(!$x IN #f)) shape:plate(!$x,20) }
CLAC tutorials
See also
- Artificial architecture
- C (programming language)
- Composition (visual arts)
- Computational creativity
- Logic programming
- Prolog
Further reading
- M. Gazzelloni: CLACL design, introduzione alla Composizione Formale. (Italian)
- M. Gazzelloni: Guida alla scrittura in CLACL.(programming manual) (Italian)
External links
Wikimedia Commons has media related to CLACL (programming language). |
- Official website
- ANCIENT GEOMETRY: And Design Standard
- Festival of Mathematics 2009 - CLAC project presentation