aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/simple.ipynb
blob: a841d33441f7e1268d0eb15f821fdf4d58920373 (plain)
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "192e31a8-1d7c-4804-8d2c-65e365b13921",
   "metadata": {},
   "source": [
    "Applause supports Jupyter via [ILua](https://github.com/guysv/ilua)!\n",
    "\n",
    "Unfortunately, there are currently some restrictions.\n",
    "\n",
    "**NOTE:** The following examples require some custom patches on top of ILua."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a0620a19-0b04-4b28-8169-fafe75002bbe",
   "metadata": {},
   "source": [
    "ILua does not require a leading `=` for printing values:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9179293d-9b2d-47b2-bb1c-4ee8cf576606",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "iota(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fd156b09-fb7d-4e0e-a055-0f0f129b1fb5",
   "metadata": {},
   "source": [
    "There is some basic plotting support via `Stream:gnuplot()`, which will automatically render into a cell instead of displaying a separate window:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "98b40a38-0ea1-4d5c-97a7-3de458812cb9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\"  standalone=\"no\"?>\n",
       "<svg \n",
       " width=\"600\" height=\"480\"\n",
       " viewBox=\"0 0 600 480\"\n",
       " xmlns=\"http://www.w3.org/2000/svg\"\n",
       " xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n",
       ">\n",
       "\n",
       "<title>Gnuplot</title>\n",
       "<desc>Produced by GNUPLOT 5.2 patchlevel 8 </desc>\n",
       "\n",
       "<g id=\"gnuplot_canvas\">\n",
       "\n",
       "<rect x=\"0\" y=\"0\" width=\"600\" height=\"480\" fill=\"none\"/>\n",
       "<defs>\n",
       "\n",
       "\t<circle id='gpDot' r='0.5' stroke-width='0.5' stroke='currentColor'/>\n",
       "\t<path id='gpPt0' stroke-width='0.222' stroke='currentColor' d='M-1,0 h2 M0,-1 v2'/>\n",
       "\t<path id='gpPt1' stroke-width='0.222' stroke='currentColor' d='M-1,-1 L1,1 M1,-1 L-1,1'/>\n",
       "\t<path id='gpPt2' stroke-width='0.222' stroke='currentColor' d='M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1'/>\n",
       "\t<rect id='gpPt3' stroke-width='0.222' stroke='currentColor' x='-1' y='-1' width='2' height='2'/>\n",
       "\t<rect id='gpPt4' stroke-width='0.222' stroke='currentColor' fill='currentColor' x='-1' y='-1' width='2' height='2'/>\n",
       "\t<circle id='gpPt5' stroke-width='0.222' stroke='currentColor' cx='0' cy='0' r='1'/>\n",
       "\t<use xlink:href='#gpPt5' id='gpPt6' fill='currentColor' stroke='none'/>\n",
       "\t<path id='gpPt7' stroke-width='0.222' stroke='currentColor' d='M0,-1.33 L-1.33,0.67 L1.33,0.67 z'/>\n",
       "\t<use xlink:href='#gpPt7' id='gpPt8' fill='currentColor' stroke='none'/>\n",
       "\t<use xlink:href='#gpPt7' id='gpPt9' stroke='currentColor' transform='rotate(180)'/>\n",
       "\t<use xlink:href='#gpPt9' id='gpPt10' fill='currentColor' stroke='none'/>\n",
       "\t<use xlink:href='#gpPt3' id='gpPt11' stroke='currentColor' transform='rotate(45)'/>\n",
       "\t<use xlink:href='#gpPt11' id='gpPt12' fill='currentColor' stroke='none'/>\n",
       "\t<path id='gpPt13' stroke-width='0.222' stroke='currentColor' d='M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z'/>\n",
       "\t<use xlink:href='#gpPt13' id='gpPt14' fill='currentColor' stroke='none'/>\n",
       "\t<filter id='textbox' filterUnits='objectBoundingBox' x='0' y='0' height='1' width='1'>\n",
       "\t  <feFlood flood-color='white' flood-opacity='1' result='bgnd'/>\n",
       "\t  <feComposite in='SourceGraphic' in2='bgnd' operator='atop'/>\n",
       "\t</filter>\n",
       "\t<filter id='greybox' filterUnits='objectBoundingBox' x='0' y='0' height='1' width='1'>\n",
       "\t  <feFlood flood-color='lightgrey' flood-opacity='1' result='grey'/>\n",
       "\t  <feComposite in='SourceGraphic' in2='grey' operator='atop'/>\n",
       "\t</filter>\n",
       "</defs>\n",
       "<g fill=\"none\" color=\"white\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M53.9,444.0 L575.0,444.0  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,444.0 L62.9,444.0 M575.0,444.0 L566.0,444.0  '/>\t<g transform=\"translate(45.6,447.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" >-1</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M53.9,337.5 L575.0,337.5  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,337.5 L62.9,337.5 M575.0,337.5 L566.0,337.5  '/>\t<g transform=\"translate(45.6,341.4)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" >-0.5</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M53.9,231.0 L575.0,231.0  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,231.0 L62.9,231.0 M575.0,231.0 L566.0,231.0  '/>\t<g transform=\"translate(45.6,234.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M53.9,124.6 L575.0,124.6  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,124.6 L62.9,124.6 M575.0,124.6 L566.0,124.6  '/>\t<g transform=\"translate(45.6,128.5)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0.5</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M53.9,18.1 L575.0,18.1  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,18.1 L62.9,18.1 M575.0,18.1 L566.0,18.1  '/>\t<g transform=\"translate(45.6,22.0)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"end\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 1</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M53.9,444.0 L53.9,18.1  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,444.0 L53.9,435.0 M53.9,18.1 L53.9,27.1  '/>\t<g transform=\"translate(53.9,465.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M106.0,444.0 L106.0,18.1  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M106.0,444.0 L106.0,435.0 M106.0,18.1 L106.0,27.1  '/>\t<g transform=\"translate(106.0,465.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0.0005</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M158.1,444.0 L158.1,18.1  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M158.1,444.0 L158.1,435.0 M158.1,18.1 L158.1,27.1  '/>\t<g transform=\"translate(158.1,465.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0.001</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M210.2,444.0 L210.2,18.1  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M210.2,444.0 L210.2,435.0 M210.2,18.1 L210.2,27.1  '/>\t<g transform=\"translate(210.2,465.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0.0015</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M262.3,444.0 L262.3,18.1  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M262.3,444.0 L262.3,435.0 M262.3,18.1 L262.3,27.1  '/>\t<g transform=\"translate(262.3,465.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0.002</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M314.5,444.0 L314.5,18.1  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M314.5,444.0 L314.5,435.0 M314.5,18.1 L314.5,27.1  '/>\t<g transform=\"translate(314.5,465.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0.0025</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M366.6,444.0 L366.6,18.1  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M366.6,444.0 L366.6,435.0 M366.6,18.1 L366.6,27.1  '/>\t<g transform=\"translate(366.6,465.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0.003</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M418.7,444.0 L418.7,18.1  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M418.7,444.0 L418.7,435.0 M418.7,18.1 L418.7,27.1  '/>\t<g transform=\"translate(418.7,465.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0.0035</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M470.8,444.0 L470.8,18.1  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M470.8,444.0 L470.8,435.0 M470.8,18.1 L470.8,27.1  '/>\t<g transform=\"translate(470.8,465.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0.004</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M522.9,444.0 L522.9,27.1 L522.9,18.1  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M522.9,444.0 L522.9,435.0 M522.9,18.1 L522.9,27.1  '/>\t<g transform=\"translate(522.9,465.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0.0045</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"currentColor\" stroke-width=\"0.50\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='gray' stroke-dasharray='2,4' class=\"gridline\"  d='M575.0,444.0 L575.0,18.1  '/></g>\n",
       "<g fill=\"none\" color=\"gray\" stroke=\"gray\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M575.0,444.0 L575.0,435.0 M575.0,18.1 L575.0,27.1  '/>\t<g transform=\"translate(575.0,465.9)\" stroke=\"none\" fill=\"black\" font-family=\"Arial\" font-size=\"12.00\"  text-anchor=\"middle\">\n",
       "\t\t<text><tspan font-family=\"Arial\" > 0.005</tspan></text>\n",
       "\t</g>\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,18.1 L53.9,444.0 L575.0,444.0 L575.0,18.1 L53.9,18.1 Z  '/></g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "\t<g id=\"gnuplot_plot_1\" ><title>gnuplot_plot_1</title>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='rgb(148,   0, 211)'  d='M56.3,229.4 L58.6,224.4 L61.0,216.4 L63.4,205.6 L65.7,192.5 L68.1,177.6 L70.4,161.5 L72.8,144.7\n",
       "\t\tL75.2,128.1 L77.5,112.4 L79.9,98.0 L82.3,85.9 L84.6,76.4 L87.0,70.0 L89.3,67.2 L91.7,68.3\n",
       "\t\tL94.1,73.2 L96.4,82.1 L98.8,94.9 L101.2,111.2 L103.5,130.7 L105.9,152.9 L108.3,177.2 L110.6,203.0\n",
       "\t\tL113.0,229.5 L115.3,256.1 L117.7,282.0 L120.1,306.6 L122.4,329.0 L124.8,348.8 L127.2,365.5 L129.5,378.7\n",
       "\t\tL131.9,388.1 L134.3,393.5 L136.6,394.9 L139.0,392.6 L141.3,386.6 L143.7,377.5 L146.1,365.6 L148.4,351.5\n",
       "\t\tL150.8,335.8 L153.2,319.3 L155.5,302.5 L157.9,286.3 L160.2,271.2 L162.6,257.8 L165.0,246.8 L167.3,238.4\n",
       "\t\tL169.7,233.1 L172.1,231.1 L174.4,232.4 L176.8,236.9 L179.2,244.6 L181.5,255.1 L183.9,268.0 L186.2,282.7\n",
       "\t\tL188.6,298.8 L191.0,315.5 L193.3,332.1 L195.7,348.0 L198.1,362.5 L200.4,375.0 L202.8,384.8 L205.1,391.5\n",
       "\t\tL207.5,394.7 L209.9,394.2 L212.2,389.6 L214.6,381.2 L217.0,368.9 L219.3,352.9 L221.7,333.8 L224.1,311.9\n",
       "\t\tL226.4,287.8 L228.8,262.1 L231.1,235.6 L233.5,209.0 L235.9,182.9 L238.2,158.2 L240.6,135.5 L243.0,115.4\n",
       "\t\tL245.3,98.3 L247.7,84.7 L250.1,74.9 L252.4,69.0 L254.8,67.1 L257.1,69.1 L259.5,74.6 L261.9,83.4\n",
       "\t\tL264.2,95.1 L266.6,108.9 L269.0,124.5 L271.3,140.9 L273.7,157.7 L276.0,174.0 L278.4,189.3 L280.8,202.9\n",
       "\t\tL283.1,214.2 L285.5,222.9 L287.9,228.5 L290.2,231.0 L292.6,230.1 L295.0,225.8 L297.3,218.5 L299.7,208.3\n",
       "\t\tL302.0,195.7 L304.4,181.1 L306.8,165.2 L309.1,148.5 L311.5,131.9 L313.9,115.8 L316.2,101.1 L318.6,88.4\n",
       "\t\tL320.9,78.3 L323.3,71.2 L325.7,67.5 L328.0,67.7 L330.4,71.7 L332.8,79.8 L335.1,91.7 L337.5,107.2\n",
       "\t\tL339.9,126.0 L342.2,147.6 L344.6,171.5 L346.9,197.0 L349.3,223.5 L351.7,250.1 L354.0,276.2 L356.4,301.1\n",
       "\t\tL358.8,324.1 L361.1,344.6 L363.5,362.0 L365.9,376.0 L368.2,386.3 L370.6,392.6 L372.9,395.0 L375.3,393.4\n",
       "\t\tL377.7,388.3 L380.0,379.8 L382.4,368.5 L384.8,354.8 L387.1,339.5 L389.5,323.1 L391.8,306.3 L394.2,289.9\n",
       "\t\tL396.6,274.5 L398.9,260.7 L401.3,249.1 L403.7,240.1 L406.0,234.0 L408.4,231.2 L410.8,231.8 L413.1,235.6\n",
       "\t\tL415.5,242.6 L417.8,252.5 L420.2,264.9 L422.6,279.2 L424.9,295.0 L427.3,311.6 L429.7,328.4 L432.0,344.5\n",
       "\t\tL434.4,359.4 L436.7,372.4 L439.1,382.8 L441.5,390.3 L443.8,394.3 L446.2,394.6 L448.6,391.0 L450.9,383.4\n",
       "\t\tL453.3,372.0 L455.7,356.9 L458.0,338.4 L460.4,317.1 L462.7,293.4 L465.1,268.0 L467.5,241.7 L469.8,215.0\n",
       "\t\tL472.2,188.8 L474.6,163.7 L476.9,140.5 L479.3,119.7 L481.7,101.9 L484.0,87.5 L486.4,76.8 L488.7,70.0\n",
       "\t\tL491.1,67.2 L493.5,68.3 L495.8,73.1 L498.2,81.2 L500.6,92.2 L502.9,105.6 L505.3,120.8 L507.6,137.1\n",
       "\t\tL510.0,153.9 L512.4,170.4 L514.7,185.9 L517.1,199.9 L519.5,211.8 L521.8,221.2 L524.2,227.5 L526.6,230.7\n",
       "\t\t '/></g>\n",
       "\t</g>\n",
       "<g fill=\"none\" color=\"white\" stroke=\"rgb(148,   0, 211)\" stroke-width=\"2.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"2.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"black\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "\t<path stroke='black'  d='M53.9,18.1 L53.9,444.0 L575.0,444.0 L575.0,18.1 L53.9,18.1 Z  '/></g>\n",
       "<g fill=\"none\" color=\"black\" stroke=\"currentColor\" stroke-width=\"1.00\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\">\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n",
       "\n"
      ]
     },
     "metadata": {
      "": ""
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "w = Stream.SinOsc(440) * Stream.SinOsc(880)\n",
    "w:sub(1, 200):gnuplot()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3cadc448-1620-44b1-8821-7e54ef0ab1c7",
   "metadata": {},
   "source": [
    "Play this sound for 5 seconds:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "d9b94d06-b5d8-42a7-93a8-25c4add1dd30",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING: Buffer underrun detected\n"
     ]
    }
   ],
   "source": [
    "w:sub(1, sec(5)):play()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "27665672-a97d-4b2e-a976-1e4ebb204ccb",
   "metadata": {},
   "source": [
    "In fact, you can play infinite streams. To interrupt them, press the \"Interrupt the kernel\" button on the toolbar.\n",
    "\n",
    "**WARNING:** Just like on the Applause command line, while you can always interrupt playing streams, you cannot reliably interrupt all commands. Add `checkint()` to tight loops. If everything fails, you might have to restart the kernel!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "78cd3b35-5e15-4c80-b7d2-dbe1be77856a",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING: Buffer underrun detected\n"
     ]
    },
    {
     "ename": "n/a",
     "evalue": "applause.lua:725: SIGINT received",
     "execution_count": 5,
     "output_type": "error",
     "traceback": [
      "applause.lua:725: SIGINT received",
      "stack traceback:",
      "\t[C]: in function 'error'",
      "\tapplause.lua:707: in function <applause.lua:663>",
      "\t[C]: in function 'xpcall'",
      "\t...ies/ilua/env/lib/python3.8/site-packages/ilua/interp.lua:65: in function 'handle_execute'",
      "\t...ies/ilua/env/lib/python3.8/site-packages/ilua/interp.lua:176: in main chunk"
     ]
    }
   ],
   "source": [
    "w:play()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "14bd4fad-e9ce-4b5f-8e46-47a140ad47e7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Lua",
   "language": "lua",
   "name": "lua"
  },
  "language_info": {
   "file_extension": ".lua",
   "mimetype": "text/x-lua",
   "name": "lua",
   "version": "n/a"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}