Skip to content

Commit

Permalink
Workaround LightTable inline-eval quirk
Browse files Browse the repository at this point in the history
Raw `true`, `false`, and `nil` in the file were preventing
inline eval and results display.

The workaround is to put these values in some expression,
like (true? true), or to comment them out entirely like for `nil`.

It is likely related to this reported issue:
LightTable/Clojure#72

The LightTable error is:

  Invalid behavior: :lt.objs.eval/inline-results
  TypeError: Cannot read property 'addEventListener' of undefined
      at Function.CodeMirror.on ...
      <truncated>
  • Loading branch information
adityaathalye committed Dec 17, 2017
1 parent 9305285 commit 66c4f48
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/clojure_by_example/ex04_control_flow.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,32 @@

;; The logical base for logic:

;; `true` and `false`
true ; boolean true
false ; boolean false
;; Boolean

(true? true) ; `true` is boolean true

(true? false) ; `false` is boolean false


;; Falsey
nil ; is the only non-boolean "falsey" value

;; `nil` is the only non-boolean "falsey" value


;; Truthy
;; - basically any non-nil value is truthy

42 ; truthy
:a ; truthy
"foo" ; truthy
[7 3] ; truthy
;; basically any non-nil value is truthy


;; Of course, falsey is NOT boolean `false`

(true? 42) ; 42 is not boolean true
;; Truthy/Falsey are NOT Boolean

;; Likewise, truthy is NOT boolean `true`
(true? 42) ; Is Truthy 42 a boolean true?

(false? nil) ; nil is not boolean false
(false? nil) ; Is Falsey nil a boolean false?


;; Truthy/Falsey can be cast to boolean true/false
Expand Down Expand Up @@ -180,7 +183,7 @@ nil ; is the only non-boolean "falsey" value

;; Evil - `even?` cannot handle nothing... so, this fails:

(filter even?
#_(filter even?
[1 2 nil 4 5 nil 7 8])

;; So... Guard functions like `even?` against the evil of nil
Expand Down

0 comments on commit 66c4f48

Please sign in to comment.