Permalink
Browse files

add strict-equal/notequal

  • Loading branch information...
1 parent 64a1c6d commit 724ec640bace45e1366ff0e745bc1beafe04c84c @ujihisa committed Jan 3, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 runtime.clj
View
@@ -54,6 +54,8 @@
+ (if (every? number? args)
(+ (first args) (second args))
(str (js-string (first args)) (js-string (second args))))
+ === (= (first args) (second args))
+ !== (not= (first args) (second args))
(if (= (:type func) :function)
(let [applied-params (into {} (map (fn [x y] [x y])
(:params func)
@@ -78,11 +80,14 @@
(recur stmts env)))))))
(defn run [stmts]
- (run- stmts {'console.log 'console.log '+ '+ 'null 'null 'undefined 'undefined 'NaN 'NaN}))
+ (run- stmts {'console.log 'console.log '+ '+ 'null 'null 'undefined 'undefined 'NaN 'NaN
+ '=== '=== '!== '!==}))
(run '[(var x 1)
(fcall 'console.log [(fcall '+ ['x "hello"])])])
(run '[(fcall (function [x]
[(fcall 'console.log ['x])])
[2])])
(run '[(fcall 'console.log [(if 0 2 3)])])
+(run '[(fcall 'console.log [(fcall '=== [1 1])])])
+(run '[(fcall 'console.log [(fcall '=== [1 2])])])

0 comments on commit 724ec64

Please sign in to comment.