File tree Expand file tree Collapse file tree 1 file changed +31
-26
lines changed
doc/modules/ROOT/pages/cljs Expand file tree Collapse file tree 1 file changed +31
-26
lines changed Original file line number Diff line number Diff line change @@ -42,35 +42,40 @@ differences everyone has to be aware of.
42
42
43
43
Here's how the standard ClojureScript behaves with multiple input forms:
44
44
45
- cljs.user>
46
- (declare is-odd?)
47
- (defn is-even? [n] (if (= n 0) true (is-odd? (dec n))))
48
- (defn is-odd? [n] (if (= n 0) false (is-even? (dec n))))
49
- #'cljs.user/is-odd?
50
- #'cljs.user/is-even?
51
- #'cljs.user/is-odd?
52
- cljs.user> (is-even? 4)
53
- true
54
-
45
+ [source,clojure]
46
+ ----
47
+ cljs.user>
48
+ (declare is-odd?)
49
+ (defn is-even? [n] (if (= n 0) true (is-odd? (dec n))))
50
+ (defn is-odd? [n] (if (= n 0) false (is-even? (dec n))))
51
+ #'cljs.user/is-odd?
52
+ #'cljs.user/is-even?
53
+ #'cljs.user/is-odd?
54
+ cljs.user> (is-even? 4)
55
+ true
56
+ ----
55
57
56
58
And here's how a Piggieback-powered REPL behaves:
57
59
58
- cljs.user>
59
- (declare is-odd?)
60
- (defn is-even? [n] (if (= n 0) true (is-odd? (dec n))))
61
- (defn is-odd? [n] (if (= n 0) false (is-even? (dec n))))
62
- #'cljs.user/is-odd?
63
- cljs.user> (is-even? 4)
64
- Compile Warning <cljs repl> line:1 column:2
65
-
66
- Use of undeclared Var cljs.user/is-even?
67
-
68
- 1 (is-even? 4)
69
- ^---
70
-
71
- #object[TypeError TypeError: Cannot read property 'call' of undefined]
72
- (<NO_SOURCE_FILE>)
73
- cljs.user>
60
+ [source,clojure]
61
+ ----
62
+ cljs.user>
63
+ (declare is-odd?)
64
+ (defn is-even? [n] (if (= n 0) true (is-odd? (dec n))))
65
+ (defn is-odd? [n] (if (= n 0) false (is-even? (dec n))))
66
+ #'cljs.user/is-odd?
67
+ cljs.user> (is-even? 4)
68
+ Compile Warning <cljs repl> line:1 column:2
69
+
70
+ Use of undeclared Var cljs.user/is-even?
71
+
72
+ 1 (is-even? 4)
73
+ ^---
74
+
75
+ #object[TypeError TypeError: Cannot read property 'call' of undefined]
76
+ (<NO_SOURCE_FILE>)
77
+ cljs.user>
78
+ ----
74
79
75
80
This difference comes from a performance optimization in Piggieback, which avoids
76
81
creating an different REPLs for each ClojureScript form it evaluates.
You can’t perform that action at this time.
0 commit comments