Skip to content

Instantly share code, notes, and snippets.

@eagleflo
Created May 13, 2013 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eagleflo/5569516 to your computer and use it in GitHub Desktop.
Save eagleflo/5569516 to your computer and use it in GitHub Desktop.
js/null in ClojureScript 0.0-1806
; This fails with Uncaught ReferenceError: null$ is not defined
(defn foo [bar] (if (== js/null bar) "foo" "bar"))
;#<
;function foo(bar) {
; if ((null$ === bar)) {
; return "foo";
; } else {
; return "bar";
; }
;}
;>
; This works
(defn foo [bar] (if (nil? bar) "foo" "bar"))
;#<
;function foo(bar) {
; if ((bar == null)) {
; return "foo";
; } else {
; return "bar";
; }
;}
;>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment