summaryrefslogtreecommitdiff
path: root/spec/inputs/backcall.yue
blob: bad3a56a235a22a419737050650c77344a775774 (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

{"abc", 123, 998} |> foreach print

{1,2,3}
	|> map (x)-> x * 2
	|> filter (x)-> x > 4
	|> reduce 0, (a,b)-> a + b
	|> print

[i |> tostring for i = 0,10] |> table.concat(",") |> print

b = 1 + 2 + (4 |> tostring |> print(1) or 123)

if x = 233 |> math.max 998
	print x

with b |> create? "new"
	.value = 123
	print \work!

123 |> f?

"abc" |> f1? |> f2?

c = "abc" |> f1? |> f2?

f = ->
	arg |> x.y?\if

998 |> func2 "abc", 233 |> func0 |> func1
998 |> func0("abc", 233) |> func1 |> func2

1 |> f 2, 3, 4, 5
val(2) |> f 1, _, 3, 4, 5
arr[3] |> f 1, 2, _, 4, 5

a = {"1","2","3"} |> table.concat("") |> tonumber |> f1(1, 2, 3, _) |> f2(1, _, 3)

readFile("example.txt") |>
	extract(_, language, {}) |>
	parse(_, language) |>
	emit |>
	render |>
	print

readFile("example.txt") \
	|> extract(_, language, {}) \
	|> parse(_, language) \
	|> emit \
	|> render \
	|> print

readFile "example.txt"
	|> extract _, language, {}
	|> parse _, language
	|> emit
	|> render
	|> print

123 |> not func! |> f

do
	_1 = list{"abc","xyz","123"}\map"#"\value!
		|> -func!
		|> abc 123, _, "x"

	global _2,_3,_4 = 1,2,3
		|> f

	local _5 = v |> f1 1
					|> f2 2
					|> f3 3
					|> f4 4

do
	(x)<- map {1,2,3}
	x * 2

do
	(x)<- map _,{1,2,3}
	x * 2

do
	(x)<- filter _, do
		(x)<- map _,{1,2,3,4}
		x * 2
	x > 2

do
	(data)<- http?.get "ajaxtest"
	body[".result"]\html data
	(processed)<- http.post "ajaxprocess", data
	body[".result"]\append processed
	<- setTimeout 1000
	print "done"

do
	<- syncStatus
	(err,data="nil")<- loadAsync "file.moon"
	if err
		print err
		return
	(codes)<- compileAsync data
	func = loadstring codes
	func!

do
	<- f1
	<- f2
	do
		<- f3
		<- f4
	<- f5
	<- f6
	f7!

do
	:result,:msg = do
		(data)<- receiveAsync "filename.txt"
		print data
		(info)<- processAsync data
		check info
	print result,msg

	totalSize = (for file in *files
		(data)<- loadAsync file
		addToCache file,data) |> reduce 0,(a,b)-> a+b

propA = do
	(value)<= property => @_value
	print "old value: #{@_value}"
	print "new value: #{value}"
	@_value = value

propB = do
	<= property _, (value)=>
		print "old value: #{@_value}"
		print "new value: #{value}"
		@_value = value
	@_value

alert "hi"

x = 123 |> a |> b or 456 |> c |> d or a.if\then("abc") or a?.b\c?(123) or x\y

x1 = 3 * -4 |> f

x2 = 3 * -2 ^ 2 |> f

y = 1 + not # 2 |> (a ^ c) |> b(3,_) * 4 ^ -123 |> f |> f1 or 123

nil