diff options
| author | Li Jin <dragon-fly@qq.com> | 2021-02-17 11:22:07 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2021-02-17 11:22:07 +0800 |
| commit | 7066392d1c974065181d95d93274136dcd625d43 (patch) | |
| tree | cf51eafc2c52cbc12246a306bca172d799193d30 /spec/inputs/backcall.mp | |
| parent | 90cd12ad9ef465f3e435e1bd034dcfbe4e19d016 (diff) | |
| download | yuescript-7066392d1c974065181d95d93274136dcd625d43.tar.gz yuescript-7066392d1c974065181d95d93274136dcd625d43.tar.bz2 yuescript-7066392d1c974065181d95d93274136dcd625d43.zip | |
stop reusing variables, rename project.
Diffstat (limited to 'spec/inputs/backcall.mp')
| -rw-r--r-- | spec/inputs/backcall.mp | 139 |
1 files changed, 0 insertions, 139 deletions
diff --git a/spec/inputs/backcall.mp b/spec/inputs/backcall.mp deleted file mode 100644 index 0d52f3f..0000000 --- a/spec/inputs/backcall.mp +++ /dev/null | |||
| @@ -1,139 +0,0 @@ | |||
| 1 | |||
| 2 | {"abc", 123, 998} |> foreach print | ||
| 3 | |||
| 4 | {1,2,3} | ||
| 5 | |> map (x)-> x * 2 | ||
| 6 | |> filter (x)-> x > 4 | ||
| 7 | |> reduce 0, (a,b)-> a + b | ||
| 8 | |||
| 9 | |||
| 10 | [i |> tostring for i = 0,10] |> table.concat(",") |> print | ||
| 11 | |||
| 12 | b = 1 + 2 + (4 |> tostring |> print(1) or 123) | ||
| 13 | |||
| 14 | if x = 233 |> math.max 998 | ||
| 15 | print x | ||
| 16 | |||
| 17 | with b |> create? "new" | ||
| 18 | .value = 123 | ||
| 19 | print \work! | ||
| 20 | |||
| 21 | 123 |> f? | ||
| 22 | |||
| 23 | "abc" |> f1? |> f2? | ||
| 24 | |||
| 25 | c = "abc" |> f1? |> f2? | ||
| 26 | |||
| 27 | f = -> | ||
| 28 | arg |> x.y?\if | ||
| 29 | |||
| 30 | 998 |> func2 "abc", 233 |> func0 |> func1 | ||
| 31 | 998 |> func0("abc", 233) |> func1 |> func2 | ||
| 32 | |||
| 33 | 1 |> f 2, 3, 4, 5 | ||
| 34 | val(2) |> f 1, _, 3, 4, 5 | ||
| 35 | arr[3] |> f 1, 2, _, 4, 5 | ||
| 36 | |||
| 37 | a = {"1","2","3"} |> table.concat("") |> tonumber |> f1(1, 2, 3, _) |> f2(1, _, 3) | ||
| 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 | |||
| 61 | do | ||
| 62 | (x)<- map {1,2,3} | ||
| 63 | x * 2 | ||
| 64 | |||
| 65 | do | ||
| 66 | (x)<- map _,{1,2,3} | ||
| 67 | x * 2 | ||
| 68 | |||
| 69 | do | ||
| 70 | (x)<- filter _, do | ||
| 71 | (x)<- map _,{1,2,3,4} | ||
| 72 | x * 2 | ||
| 73 | x > 2 | ||
| 74 | |||
| 75 | do | ||
| 76 | (data)<- http?.get "ajaxtest" | ||
| 77 | body[".result"]\html data | ||
| 78 | (processed)<- http.post "ajaxprocess", data | ||
| 79 | body[".result"]\append processed | ||
| 80 | <- setTimeout 1000 | ||
| 81 | print "done" | ||
| 82 | |||
| 83 | do | ||
| 84 | <- syncStatus | ||
| 85 | (err,data="nil")<- loadAsync "file.moon" | ||
| 86 | if err | ||
| 87 | print err | ||
| 88 | return | ||
| 89 | (codes)<- compileAsync data | ||
| 90 | func = loadstring codes | ||
| 91 | func! | ||
| 92 | |||
| 93 | do | ||
| 94 | <- f1 | ||
| 95 | <- f2 | ||
| 96 | do | ||
| 97 | <- f3 | ||
| 98 | <- f4 | ||
| 99 | <- f5 | ||
| 100 | <- f6 | ||
| 101 | f7! | ||
| 102 | |||
| 103 | do | ||
| 104 | :result,:msg = do | ||
| 105 | (data)<- receiveAsync "filename.txt" | ||
| 106 | print data | ||
| 107 | (info)<- processAsync data | ||
| 108 | check info | ||
| 109 | print result,msg | ||
| 110 | |||
| 111 | totalSize = (for file in *files | ||
| 112 | (data)<- loadAsync file | ||
| 113 | addToCache file,data) |> reduce 0,(a,b)-> a+b | ||
| 114 | |||
| 115 | propA = do | ||
| 116 | (value)<= property => @_value | ||
| 117 | print "old value: #{@_value}" | ||
| 118 | print "new value: #{value}" | ||
| 119 | @_value = value | ||
| 120 | |||
| 121 | propB = do | ||
| 122 | <= property _, (value)=> | ||
| 123 | print "old value: #{@_value}" | ||
| 124 | print "new value: #{value}" | ||
| 125 | @_value = value | ||
| 126 | @_value | ||
| 127 | |||
| 128 | alert "hi" | ||
| 129 | |||
| 130 | x = 123 |> a |> b or 456 |> c |> d or a.if\then("abc") or a?.b\c?(123) or x\y | ||
| 131 | |||
| 132 | x1 = 3 * -4 |> f | ||
| 133 | |||
| 134 | x2 = 3 * -2 ^ 2 |> f | ||
| 135 | |||
| 136 | y = 1 + not # 2 |> (a ^ c) |> b(3,_) * 4 ^ -123 |> f |> f1 or 123 | ||
| 137 | |||
| 138 | nil | ||
| 139 | |||
