Permalink
Browse files

add if

no changes added to commit (use "git add" and/or "git commit -a")
  • Loading branch information...
1 parent a50de0f commit 64a1c6d6c0acc24bbeff540d8efdde85b8912156 @ujihisa committed Jan 3, 2013
Showing with 5 additions and 0 deletions.
  1. +5 −0 runtime.clj
View
@@ -40,6 +40,10 @@
(if (list? expr)
(let [[car & cdr] expr]
(case car
+ if (let [[cond- then- else-] cdr]
+ (if (js-boolean (evaluate cond- env))
+ (evaluate then- env)
+ (evaluate else- env)))
function (let [params (first cdr)
body (second cdr)]
{:type :function :params params :body body})
@@ -81,3 +85,4 @@
(run '[(fcall (function [x]
[(fcall 'console.log ['x])])
[2])])
+(run '[(fcall 'console.log [(if 0 2 3)])])

0 comments on commit 64a1c6d

Please sign in to comment.