-
Notifications
You must be signed in to change notification settings - Fork 0
/
program.txt
59 lines (49 loc) · 855 Bytes
/
program.txt
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
# Sample "Hello World":
def main() {
let hello = "Hello"
let world = "World"
print(hello + " " + world)
}
# Sample Fibonacci (iterative):
def main() {
let prev = 0
let cur = 1
for(i in range(10)) {
print(cur)
let tmp = cur
cur = prev + cur
prev = tmp
}
}
def main() {
let prev = 0
let cur = 1
let i = 0
while (i < 10) {
print(cur)
let tmp = cur
cur = prev + cur
prev = tmp
i = i + 1
}
}
def add2(a) {
a + 2
}
def multn(n) {
lambda(x) { x*n }
}
def get(url, handler) {
# hook the handler up to the http server
}
get("/") {
"Some html."
}
def annotate(f, f_name) {
lambda() {
print("Executing " + f_name ".\n")
f()
print("Finishing " + f_name ".\n")
}
}
annotate(main, "fib")()