-
Notifications
You must be signed in to change notification settings - Fork 0
/
examples.src.html
237 lines (202 loc) · 8.37 KB
/
examples.src.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<div class="row">
<div class="col-md-3">
<div class="sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header disabled"><a>Try ReactiveML</a></li>
<li><a href="<#ROOTDIR>/tryrml/tryrml.html"> Try it online</a></li>
<li><a href="<#ROOTDIR>/distrib"> Download</a></li>
<li class="nav-header disabled"><a>Examples</a></li>
<li><a href="#breadth"> Breadth first traversal</a></li>
<li><a href="#jacques"> Frère Jacques</a></li>
<li><a href="#nbody"> N-body</a></li>
<li><a href="#cell"> Cellular automata</a></li>
<li class="nav-header disabled"><a>Projects</a></li>
<li><a href="<#ROOTDIR>/examples/simulator_elip/index.html"> Network simulation</a></li>
<li><a href="<#ROOTDIR>/glonemo/index.html"> Glonemo</a></li>
<li><a href="<#ROOTDIR>/reactive_asco/index.html"> Reactive Asco</a></li>
</ul>
</div>
</div>
<div class="col-md-9">
<h1>Examples</h1>
<hr>
<p>
Examples are available in the <a href="<#ROOTDIR>/distrib/rml-<#RML_VERSION>-<#DATE>.tar.gz">source distribution</a>.
</p>
<!-- <section id="hello"> -->
<!-- <h3>Hello World!</h3> -->
<!-- The famous "Hello World!" written using two parallel -->
<!-- processes and an internal communication. -->
<!-- <br><br> -->
<!-- <pre> -->
<!-- <span class="type">let</span> <span class="type">process</span> hello_word = -->
<!-- <span class="type">signal</span> s <span class="type">in</span> -->
<!-- <span class="type">await</span> s; print_string <span class="string">"World!"</span> -->
<!-- <span class="constant">||</span> -->
<!-- print_string <span class="string">"Hello "</span>; <span class="builtin">emit</span> s</pre> -->
<!-- </section> -->
<!-- <hr> -->
<section id="breadth">
<h3>Breadth First Traversal of a Tree</h3>
Breadth first traveral of a binary tree using parallel composition (<code>||</code>) and synchronization of logical time (<code>pause</code>). A level of the tree is traversed at each logical instant.
<br><br
<!-- *************************** -->
<pre>
<span style="color: #b22222;">(* </span><span style="color: #b22222;">Definition of binary trees. </span><span style="color: #b22222;">*)</span>
<span style="color: #228b22;">type</span> 'a tree =
<span style="color: #008b8b;">|</span> <span style="color: #0000ff;">Empty</span>
<span style="color: #008b8b;">|</span> <span style="color: #0000ff;">Node</span> <span style="color: #228b22;">of</span> 'a * 'a tree * 'a tree
<span style="color: #b22222;">(* </span><span style="color: #b22222;">Breadth first traveral. </span><span style="color: #b22222;">*)</span>
<span style="color: #228b22;">let</span> <span style="color: #228b22;">rec</span> <span style="color: #228b22;">process</span> iter_breadth f t =
<span style="color: #008b8b;">match</span> t <span style="color: #008b8b;">with</span>
<span style="color: #008b8b;">|</span> <span style="color: #0000ff;">Empty</span> <span style="color: #008b8b;">-></span> ()
<span style="color: #008b8b;">|</span> <span style="color: #0000ff;">Node</span> (x, l, r) <span style="color: #008b8b;">-></span>
f x;
<span style="color: #483d8b;">pause</span>;
<span style="color: #483d8b;">run</span> (iter_breadth f l) <span style="color: #008b8b;">||</span> <span style="color: #483d8b;">run</span> (iter_breadth f r)</pre>
<!-- *************************** -->
</section>
<hr>
<section id="jacques">
<h3>Frère Jacques</h3>
<br>
<div class="row">
<div class="col-md-7">
<div class="thumbnail">
<img src="<#ROOTDIR>/reactive_asco/resources/score_jacques.png" alt="jacques">
</div>
</div>
<div class="col-md-5">
<p>
Here, we present a musical library written in ReactiveML
through a simple example: the classic French musical round
"Frère Jacques".
</p>
<p><a class="btn btn-default"
href="<#ROOTDIR>/reactive_asco/code/jacques.html">View Details »</a></p>
</div>
</div>
</section>
<hr>
<section id="nbody">
<h3>Dynamic Planets</h3>
<br>
<!-- <a href="examples/physics/planets.png"><img src="examples/physics/thumb_planets.png" alt="Planets"></a> -->
<div class="row">
<div class="col-md-4">
<div class="thumbnail">
<img src="examples/physics/thumb_planets.png" alt="Planets">
<div class="caption">
N-body
</div>
</div>
</div>
<div class="col-md-8">
<p>
In the ReactiveML distribution, you can find the classical
N-body problem where the number of objects can change during
the execution.
<br>
A new planet is created when the mouse
button is pressed.
The key 'k' removes the planets in the order of creation
and 's' removes the sun.
The execution can be suspended and resumed with the key 'p'.
<br>
This example has also been used in a tutorial for the
ReactiveML toplevel.
</p>
<p><a class="btn btn-default"
href="<#ROOTDIR>/examples/physics/index.html">View Details »</a></p>
</div>
</div>
</section>
<hr>
<section id="cell">
<h3>Cellular Automata</h3>
<br>
<p>
In the ReactiveML distribution, you can also find an
implementation of cellular automata that has been made from
the one of Frédéric Boussinot in
<a href="http://www-sop.inria.fr/mimosa/rp/LOFT">Loft</a>
that can be found
<a href="http://www-sop.inria.fr/mimosa/rp/CellularAutomata">here</a>.
It takes advantage of the ReactiveML runtime to avoid useless
computations.
Moreover, the implementation uses higher order processes to
parameterize the cells by their behavior.
<p>
<div class="row">
<div class="col-md-4">
<div class="thumbnail">
<img src="examples/cellular_automata/thumb_gol.png" alt="game of life">
<div class="caption">
John Conway's Game of Life
</div>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<img src="examples/cellular_automata/thumb_fredkin.png" alt="fredkin">
<div class="caption">
Fredkin's automaton
</div>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail">
<img src="examples/cellular_automata/thumb_fire.png" alt="fire">
<div class="caption">
"Forest fire" automaton
</div>
</div>
</div>
</div>
</section>
<br><br>
<h1>Projects</h1>
<hr>
<section id="network">
<div class="row">
<div class="col-md-9">
<h3>Network simulator</h3>
<p>Simulation of a complex network routing protocol for
mobile ad hoc networks.</p>
</div>
<div class="col-md-3">
<p><a class="btn btn-default"
href="examples/simulator_elip/index.html">View details
»</a></p>
</div>
</div>
</section>
<section id="glonemo">
<div class="row">
<div class="col-md-9">
<h3>Glonemo</h3>
<p>Glonemo (for Global network model) is a simulation tool for
sensor networks.</p>
</div>
<div class="col-md-3">
<p><a class="btn btn-default" href="<#ROOTDIR>/glonemo/">View details
»</a></p>
</div>
</div>
</section>
<section id="reactiveasco">
<div class="row">
<div class="col-md-9">
<h3>Reactive Asco</h3>
<p> An embedding
of <a href="http://repmus.ircam.fr/antescofo">Antescofo</a>, a domain-specific language for interactive mixed music.
</p>
</div>
<div class="col-md-3">
<p><a class="btn btn-default" href="<#ROOTDIR>/reactive_asco/index.html">View
details »</a></p>
</div>
</div>
</section>
</div>
</div>