diff options
Diffstat (limited to 'spec/inputs/funcs.mp')
-rw-r--r-- | spec/inputs/funcs.mp | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/spec/inputs/funcs.mp b/spec/inputs/funcs.mp new file mode 100644 index 0000000..4176e33 --- /dev/null +++ b/spec/inputs/funcs.mp | |||
@@ -0,0 +1,160 @@ | |||
1 | |||
2 | |||
3 | x = -> print what | ||
4 | |||
5 | _ = -> | ||
6 | |||
7 | _ = -> -> -> | ||
8 | |||
9 | go to the barn | ||
10 | |||
11 | open -> the -> door | ||
12 | |||
13 | open -> | ||
14 | the door | ||
15 | hello = -> | ||
16 | my func | ||
17 | |||
18 | h = -> hi | ||
19 | |||
20 | eat ->, world | ||
21 | |||
22 | |||
23 | (->)() | ||
24 | |||
25 | x = (...) -> | ||
26 | |||
27 | hello! | ||
28 | hello.world! | ||
29 | |||
30 | _ = hello!.something | ||
31 | _ = what!["ofefe"] | ||
32 | |||
33 | what! the! heck! | ||
34 | |||
35 | _ = (a,b,c,d,e) -> | ||
36 | |||
37 | _ = (a,a,a,a,a) -> | ||
38 | print a | ||
39 | |||
40 | _ = (x=23023) -> | ||
41 | |||
42 | _ = (x=(y=()->) ->) -> | ||
43 | |||
44 | _ = (x = if something then yeah else no) -> | ||
45 | |||
46 | something = (hello=100, world=(x=[[yeah cool]])-> print "eat rice") -> | ||
47 | print hello | ||
48 | |||
49 | _ = (x, y) => | ||
50 | _ = (@x, @y) => | ||
51 | _ = (x=1) => | ||
52 | _ = (@x=1,y,@z="hello world") => | ||
53 | |||
54 | |||
55 | x -> return | ||
56 | y -> return 1 | ||
57 | z -> return 1, "hello", "world" | ||
58 | k -> if yes then return else return | ||
59 | |||
60 | _ = -> real_name if something | ||
61 | |||
62 | -- | ||
63 | |||
64 | d( | ||
65 | -> | ||
66 | print "hello world" | ||
67 | 10 | ||
68 | ) | ||
69 | |||
70 | |||
71 | |||
72 | d( | ||
73 | 1,2,3 | ||
74 | 4 | ||
75 | 5 | ||
76 | 6 | ||
77 | |||
78 | if something | ||
79 | print "okay" | ||
80 | 10 | ||
81 | |||
82 | 10,20 | ||
83 | ) | ||
84 | |||
85 | |||
86 | f( | ||
87 | |||
88 | )( | ||
89 | |||
90 | )( | ||
91 | what | ||
92 | )(-> | ||
93 | print "srue" | ||
94 | 123) | ||
95 | |||
96 | -- | ||
97 | |||
98 | x = (a, | ||
99 | b) -> | ||
100 | print "what" | ||
101 | |||
102 | |||
103 | y = (a="hi", | ||
104 | b=23) -> | ||
105 | print "what" | ||
106 | |||
107 | z = ( | ||
108 | a="hi", | ||
109 | b=23) -> | ||
110 | print "what" | ||
111 | |||
112 | |||
113 | j = (f,g,m, | ||
114 | a="hi", | ||
115 | b=23 | ||
116 | ) -> | ||
117 | print "what" | ||
118 | |||
119 | |||
120 | y = (a="hi", | ||
121 | b=23, | ||
122 | ...) -> | ||
123 | print "what" | ||
124 | |||
125 | |||
126 | y = (a="hi", | ||
127 | b=23, | ||
128 | ... | ||
129 | ) -> | ||
130 | print "what" | ||
131 | |||
132 | -- | ||
133 | |||
134 | args = (a | ||
135 | b) -> | ||
136 | print "what" | ||
137 | |||
138 | |||
139 | args = (a="hi" | ||
140 | b=23) -> | ||
141 | print "what" | ||
142 | |||
143 | args = ( | ||
144 | a="hi" | ||
145 | b=23) -> | ||
146 | print "what" | ||
147 | |||
148 | |||
149 | args = (f,g,m | ||
150 | a="hi" | ||
151 | b=23 | ||
152 | ) -> | ||
153 | print "what" | ||
154 | |||
155 | |||
156 | @ = (n)-> | ||
157 | return 1 if n == 0 | ||
158 | n * @(n-1) | ||
159 | |||
160 | nil | ||