Repository navigation
Expand file tree
/
Copy pathtest.win
More file actions
111 lines (56 loc) · 1.79 KB
/
Copy pathtest.win
File metadata and controls
111 lines (56 loc) · 1.79 KB
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
def main() : 123.f
#has_binary_mult
#generic T : has_binary_mult
#def identity(int x) int : x
#def square<T>(T x) T : x * x
#def main() float :
# let z = [1.0, 2.0, 3.0, 4.0]v
# in
# (e0(z) + e1(z)) + (e2(z) + e3(z))
#decl map<T1, T2>(function<T1, T2>, array<T1>) array<T2>
#decl fold<T>(function<T, T, T>, array<T>, T) T
#def addAnInt<T>(int a, T b, T c) T : a + b
#def sum(array<float> x) float :
# fold(\(float y, float s) float : y + s, x, 0.0)
#def mul(array<float> x) float :
# fold(\(float y, float s) float : y * s, x, 1.0)
#def addOneToElements(array<float> x) array<float> :
# map(\(float y) float : (y + 1.0), x)
#def main() float :
# fold(\(float y, float s) float : y + s, [1.0,2.0,3.0,4.0,5.0], 0.0)
#struct Complex
#{
# float re,
# float im
#}
#def complexFunc() Complex :
# Complex(1.0, 2.0)
#def add (Complex a, Complex b) Complex :
# Complex(re(a) + re(b), im(a) + im(b))
#def funcWithLambdaArg(function<int, int> f, int x) int :
# f(f(x))
#def stringFunc() string :
# "bleh"
#def funcThatReturnsLambda() function<int> :
# \() int : 10
#def main() float :
# im(add(Complex(1.0, 4.0), Complex(10.0, 100.0)))
#let z = \(int a) int : a + 1
#funcWithLambdaArg(z, 3)
#def lambdaTest(int x) int :
# let z = \(int a) int : a + 3
# z(x)
#def test
#1 + 1 == 3 # comment
#dsfg
#def operator_add(complex x, complex y) complex : complex(re(x) + re(y), im(x) + im(y))
#c + d
#def e() map<int, int> : { g(1, 3) : e() , 666:777}
#def f(int x) int : 3 * x
#def g(int x, int y) int : x + x * x
#def h(int x, int y) int : (x + x) * x
#def i(int x, int y) int : x - x * x
#def g(float x, float y) float : x + y
#def square(int x) int :
# let y = f(x)
# x*y