Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add if

no changes added to commit (use "git add" and/or "git commit -a")
  • Loading branch information...
commit 64a1c6d6c0acc24bbeff540d8efdde85b8912156 1 parent a50de0f
@ujihisa authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 runtime.clj
View
5 runtime.clj
@@ -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)])])
Please sign in to comment.
Something went wrong with that request. Please try again.