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
console.log("Hello World");
var x = 12;
var y = [1, 2, 3];
var z = "This-is-string";
var o = {
    a: 12,
    b: 13,
    [z]: "Hi There"
};
x = 13;
y[0] = 4;
o.a = 15;
o[z] = 17;
function add(ab) {
    return (a + b);
};
add(3, 4);
function abs(x) {
    if ((x > 0)) {
        return x
    } else {
        return (-x)
    };
};
var greater_than_0 = ((x > 0) ? x : 0);
(function(input_$45_string) {
    return console.log(input_$45_string);
})("Hi There");
var value = ((function() {
    var x = 1;
    var y = 2;
    var z = (x + y);
    return (x * y * z);
})());
var my_array = (new Array(1, 2, 3, 4, 5));
console.log(my_array);
var x = 1;
var y = 2;
var z = 3;
(x + y + z);
(12 * 12);
(12 * 12);
((15 * 15) + (16 * 16));
var x = cons(1, cons(2, cons(3, cons(4, null))));
var a = 1;
var b = 2;
var c = 3;
var d = cons(a, cons("a", cons(b, cons("b", cons(cons(c, cons("c", null)), null)))));
console.log(d.toString());
var x = list(a, b, c, d);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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
    ;; This is the comment
    ;; Please use Firefox to run compiled ECMAScript 6
    ;; Please open Web Console to see console.log result.
    ;; github link : https://github.com/shd101wyy/lisp2js
    ;; npm link    : https://www.npmjs.com/package/lisp2js
    ;; hello world
    (console.log "Hello World")
    ;; define a variable
    (def x 12)
    (def y [1 2 3])
    (def z 'This-is-string )
    (def o {:a 12 :b 13 z "Hi There"})
    ;; change a variable value
    (set! x 13)
    (set! y[0] 4)
    (set! o.a 15)
    (set! o[z] 17)
    ;; define a function
    (defn add [a b]
        (+ a b))
    ;; call a function
    (add 3 4)
    ;; if statement
    (defn abs [x]
        (if (> x 0)
            x
            (- x)))
    (def greater_than_0 (if (> x 0) x 0))
    ;; anonymous function call
    ((fn [input-string] (console.log input-string)) "Hi There")
    ;; let
    (def value
        (let [x 1
              y 2
              z (+ x y)]
             (* x y z)))
    ;; new
    (def my_array (new Array 1 2 3 4 5))
    (console.log my_array)
    ;; do
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX