summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-02-10 14:34:08 +0800
committerLi Jin <dragon-fly@qq.com>2021-02-10 20:50:03 +0800
commitc68e11bc6d7631185749aaf0c8d89147b3ac9cc9 (patch)
treee91306fa43513f7a66022ba16abbc224a91c8bd5 /spec
parent9f622c5bbd9cfb7e66a9fd3c371461af4249d566 (diff)
downloadyuescript-c68e11bc6d7631185749aaf0c8d89147b3ac9cc9.tar.gz
yuescript-c68e11bc6d7631185749aaf0c8d89147b3ac9cc9.tar.bz2
yuescript-c68e11bc6d7631185749aaf0c8d89147b3ac9cc9.zip
update backcall operator syntax, fix issue #31.
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/backcall.mp28
1 files changed, 25 insertions, 3 deletions
diff --git a/spec/inputs/backcall.mp b/spec/inputs/backcall.mp
index a648b16..0d52f3f 100644
--- a/spec/inputs/backcall.mp
+++ b/spec/inputs/backcall.mp
@@ -2,9 +2,9 @@
2{"abc", 123, 998} |> foreach print 2{"abc", 123, 998} |> foreach print
3 3
4{1,2,3} 4{1,2,3}
5 |> map((x)-> x * 2) 5 |> map (x)-> x * 2
6 |> filter((x)-> x > 4) 6 |> filter (x)-> x > 4
7 |> reduce(0, (a,b)-> a + b) 7 |> reduce 0, (a,b)-> a + b
8 |> print 8 |> print
9 9
10[i |> tostring for i = 0,10] |> table.concat(",") |> print 10[i |> tostring for i = 0,10] |> table.concat(",") |> print
@@ -36,6 +36,28 @@ arr[3] |> f 1, 2, _, 4, 5
36 36
37a = {"1","2","3"} |> table.concat("") |> tonumber |> f1(1, 2, 3, _) |> f2(1, _, 3) 37a = {"1","2","3"} |> table.concat("") |> tonumber |> f1(1, 2, 3, _) |> f2(1, _, 3)
38 38
39readFile "example.txt"
40 |> extract _, language, {}
41 |> parse _, language
42 |> emit
43 |> render
44 |> print
45
46123 |> not func! |> f
47
48do
49 _1 = list{"abc","xyz","123"}\map"#"\value!
50 |> -func!
51 |> abc 123, _, "x"
52
53 global _2,_3,_4 = 1,2,3
54 |> f
55
56 local _5 = v |> f1 1
57 |> f2 2
58 |> f3 3
59 |> f4 4
60
39do 61do
40 (x)<- map {1,2,3} 62 (x)<- map {1,2,3}
41 x * 2 63 x * 2