CLACL
{{copy edit|date=March 2014}}
{{Use dmy dates|date=July 2013}}
{{Infobox programming language
| name = CLACL
| paradigm = [[Logic programming]]
| year = 2000
| designer = Mauro Gazzelloni
| developer = Mauro Gazzelloni
| released = January 2000
| latest_release_version = 1.04
| latest_release_date = April 2013
| programming language = [[C++]]
| influenced by = [[Prolog]], [[C (programming language)|C]]
| operating system = [[Microsoft Windows]]
| language = Italian
| status = in ACTIVE development
| license = 2000-2014 Mauro Gazzelloni
| website = [http://www.1stleft.com/clac/English/index.htm Project Site]
}}
'''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 organisational processes of [[Composition (visual arts)|composition]].
The logic of CLACL is not based on the processing of numerical information, but rather on 'spatial-relational' information. It generates a logical configuration and, with a tool called Plasma, you can shape the created domain in a physical form such as music or graphics.
[http://www.1stleft.com/wiki/lib/exe/fetch.php?h=250&media=guida:manuale_utente_clac-ooo_odt_m5d0327be.gif An example of Instances and Domain]
[http://www.1stleft.com/wiki/lib/exe/fetch.php?h=250&media=guida:manuale_utente_clac-ooo_odt_5e249d1a.gif An example of a Model]
CLACL is a computing language and integrates into a production environment that provides several tools to facilitate the writing of the code and its graphical representation.
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 [http://www.auditorium.com/eventi/4937211 2009 Festival of Mathematics] held in Rome, during which the [http://www.auditorium.com/eventi/4939870 project CLAC] was presented.
==Characteristics of the Language==
The target of potential users of the language are those who work within the creative fields in different areas: from design to Music.
[[File:Creative-Sierpinski-1.png|thumb|Example of creative generation created with CLACL.]]
Every design work produces an organism, more or less complex and complete, in which all of its parts are in mutual relation.
For a better understanding let us consider the graphic planning, that is the design and realization of a graphic pattern.
Those that have had a chance to prepare a composition, know that every element should be in a precise relation with the others and only when all the elements are balanced can the composition be considered done. This is a process that can be proven and verified.
Since the compositional process is guided by logical choices, the program is centred on the information science area of Artificial Intelligence.
It is for this reason that the project is mentioned in the entry [[Computational creativity]] [[Computational creativity#External links|External_links]] in the 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 [[Control flow#Loops|cycle (loop)]] implemented in [[Prolog]] and CLACL.
With the following example in [[prolog]], a loop is 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:
<code>
@PRINT("$x $y",NL)
FOR ( $x, $y ) IN II[]
{
@PRINT($x,$y,NL)
}
</code>
result:
$x $y<br/>
!a !a<br/>
!a !b<br/>
!a !c<br/>
!b !a<br/>
!b !b<br/>
!b !c<br/>
!c !a<br/>
!c !b<br/>
!c !c
the formation of the cycle in CLACL is carried out in a very similar way to the [[C (programming language)|C-Language]].
≈The language adopts a combination of the declarative and procedural paradigms.
The two languages are Prolog and [[C (programming language)|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 (programming language)|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 of controls is to produce a logical configuration of entities and represent it in graphic form, and as such, as a product of processing, there will be a graph. The set of entities that form part of the graph is 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.<br />
The ''controls'' implement constructs for controlling the flow of the code with loops and expressions.<br />
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
and additionally implements specialist concepts of the domain of the issues which address:
*Statements
*Tests
*States
The entities that can be generated via the interpretation of the script are:
*instances
*relations
*models
*shapes
*figure
;[[Instance (computer science)|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.
;[[wikt:Relation (philosophy)|Relation]]
:A relation describes the relationship between different instances.
;[[wikt:Model|Model]]
:A model allows the description of complex relations.
;[[wikt:Shape|Shape]]
:The shape describes the characteristics of a ''logical figure''.
;Figure
:A ''logical figure'' can be seen as a geometrical figure.
{|
|-
| [[File:CLACL directions.png|thumb|Application of figures realized with CLACL]]
|}
==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.
|-
| [[File:CLACL Campidoglio-1.png|thumb|Composition of the Piazza del Campidoglio with CLACL.]]
|}
==Spatial Expression Example==
!a<BR>
!b<BR>
model:modSquare4(!a,!b,!c,!d)
#f=shape:frmSquare4(!a,!b,!c,!d)
I[]=cloud(!a,UNIFORM,100,1)<BR>
<BR>
@GRFILL(Red)<BR>
FOR ($x) IN I[]<BR>
{<BR>
CASE(pos(!$x IN #f))<BR>
shape:plate(!$x,20)<BR>
}
{|
|-
| [[File:CLACL stat exp.png|thumb|Using spatial expression with CLACL]]
|}
== CLAC Tutorials ==
* [http://www.1stleft.com/CLAC/help/tutorial/index.htm CLAC Tutorials]
== Books about CLAC ==
* M. Gazzelloni: [http://www.1stleft.com/Pubblicazioni/ComposizioneFormale/index.html ''CLACL design, introduzione alla Composizione Formale.''] (Italian)
* M. Gazzelloni: [http://www.1stleft.com/Pubblicazioni/GuidaAllaScrittura/index.html ''Guida alla scrittura in CLACL.(programming manual)''] (Italian)
==See also==
* [[Logic programming]]
* [[C (language)]]
* [[Prolog]]
==References==
<!--*[[Artificial Creativity#External links|Computational creativity - External links]]-->
*[[Artificial Creativity|Computational creativity]]
*[[Composition (visual arts)]]
==External links==
<!--*''[http://www.1stleft.com/clac/English/index.htm CLAC Project Site]''.-->
<!--*''[http://www.1stleft.com/wiki/doku.php wiki]''-->
* {{official website|http://www.1stleft.com/clac/English/index.htm}}
* [http://www.robertschoch.net/Hexagon%20Solstice%20Kiva.htm ANCIENT GEOMETRY: And Design Standard]
* [http://www.auditorium.com/eventi/4937211 Rome/NYC 2009 Festival of Mathematics 2009.]
* [http://www.auditorium.com/eventi/4939870 Festival of Mathematics 2009 - CLAC project presentation]
{{DEFAULTSORT:Clacl (Programming Language)}}
[[Category:Free compilers and interpreters]]
[[Category:Logic programming languages]]
[[Category:Composition in visual art]]