From 30bb7de9b26104ffe3991ebaeb5a794253944ce2 Mon Sep 17 00:00:00 2001 From: zaoqi Date: Sun, 3 Dec 2017 15:50:31 +0800 Subject: [PATCH] if if/begin --- js.cscm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/js.cscm b/js.cscm index 2708b59..e35228e 100644 --- a/js.cscm +++ b/js.cscm @@ -100,6 +100,23 @@ (EVAL (second xs) (λ (xs) (k (++ f"(..."xs")"))))))] + [(eq? f 'if) + (EVAL (first xs) + (λ (b) + (EVAL (second xs) + (λ (x) + (EVAL (third xs) + (λ (y) + (k (++ "("b"?"x":"y")"))))))))] + [(eq? f 'if/begin) + (EVAL (first xs) + (λ (b) + (++ "if("b"){" + (BEGIN (second xs) ig) + "}else{" + (BEGIN (thirs xs) ig) + "}" + (k undefined))))] [else (EVAL f (λ (f) (EVALxs xs (λ (xs) (k (++ f"("(add-between xs ",")")"))))))])]))