-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore_surface.echo
More file actions
64 lines (57 loc) · 914 Bytes
/
Copy pathcore_surface.echo
File metadata and controls
64 lines (57 loc) · 914 Bytes
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
; Core surface smoke (see echo26/run/core/001_surface)
/ std/io
/ std/str
~ n = 0
* n < 10 {
? n == 3 {
<
}
~ n = n + 1
}
io.print(str.from_int(n))
$ xs = [1, 2, 3]
~ xs[1] = 9
io.print(str.from_int(xs[1]))
$ pure = 'core'
io.print("ok={pure}")
% box {
~ v
$ bump = () {
~ .v = .v + 1
^ .v
}
}
$ b = box { v: 10 }
io.print(str.from_int(b.bump()))
$ div = (a, d) {
? d == 0 {
! 0
}
^ a / d
}
| div(20, 4) {
$ q {
io.print(str.from_int(q))
}
! e {
io.print(str.from_int(e))
}
}
$ maybe = (x) {
? x < 0 {
^
}
^ x
}
| maybe(8) {
$ v {
io.print(str.from_int(v))
}
: {
io.print(str.from_int(0))
}
}
io.print(str.from_int(<i32> 10 + <i32> 20))
io.print(str.from_float(<f32> 1.5 + <f32> 2.25))
io.print(str.from_float(3.0 * 2.0))
io.print(str.from_bytes(b'raw'))