diff options
author | Li Jin <dragon-fly@qq.com> | 2021-02-10 14:34:08 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-02-10 20:50:03 +0800 |
commit | c68e11bc6d7631185749aaf0c8d89147b3ac9cc9 (patch) | |
tree | e91306fa43513f7a66022ba16abbc224a91c8bd5 /spec | |
parent | 9f622c5bbd9cfb7e66a9fd3c371461af4249d566 (diff) | |
download | yuescript-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.mp | 28 |
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 | 8 | ||
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 | ||
37 | a = {"1","2","3"} |> table.concat("") |> tonumber |> f1(1, 2, 3, _) |> f2(1, _, 3) | 37 | a = {"1","2","3"} |> table.concat("") |> tonumber |> f1(1, 2, 3, _) |> f2(1, _, 3) |
38 | 38 | ||
39 | readFile "example.txt" | ||
40 | |> extract _, language, {} | ||
41 | |> parse _, language | ||
42 | |> emit | ||
43 | |> render | ||
44 | |||
45 | |||
46 | 123 |> not func! |> f | ||
47 | |||
48 | do | ||
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 | |||
39 | do | 61 | do |
40 | (x)<- map {1,2,3} | 62 | (x)<- map {1,2,3} |
41 | x * 2 | 63 | x * 2 |