mirror of
https://github.com/kanaka/mal.git
synced 2024-09-11 21:57:38 +03:00
- Reorder README to have implementation list after "learning tool" bullet. - This also moves tests/ and libs/ into impls. It would be preferrable to have these directories at the top level. However, this causes difficulties with the wasm implementations which need pre-open directories and have trouble with paths starting with "../../". So in lieu of that, symlink those directories to the top-level. - Move the run_argv_test.sh script into the tests directory for general hygiene.
40 lines
696 B
Plaintext
40 lines
696 B
Plaintext
;; Testing basic bash interop
|
|
|
|
(js-eval "7")
|
|
;=>7
|
|
|
|
(js-eval "'7'")
|
|
;=>"7"
|
|
|
|
(js-eval "[7,8,9]")
|
|
;=>(7 8 9)
|
|
|
|
(js-eval "console.log('hello');")
|
|
;/hello
|
|
;=>nil
|
|
|
|
(js-eval "foo=8;")
|
|
(js-eval "foo;")
|
|
;=>8
|
|
|
|
(js-eval "['a','b','c'].map(function(x){return 'X'+x+'Y'}).join(' ')")
|
|
;=>"XaY XbY XcY"
|
|
|
|
(js-eval "[1,2,3].map(function(x){return 1+x})")
|
|
;=>(2 3 4)
|
|
|
|
(js-eval (str "3 * " (* 4 5)))
|
|
;=>60
|
|
|
|
(. "console.log" "abc" 123 '(4 5 6) {"kk" "vv"} (= 1 1) nil)
|
|
;/abc 123 \[ 4, 5, 6 \] \{ kk: 'vv' \} true null
|
|
;=>nil
|
|
|
|
(js-eval "myobj = { v: 10, myfunc: function(a,b,c) { return a * b * c * this.v; } }")
|
|
(. "myobj.myfunc" 2 3 4)
|
|
;=>240
|
|
|
|
(js-eval "myarray = [1,2,3,4,5]")
|
|
(. "myarray.join" "#")
|
|
;=>"1#2#3#4#5"
|