Skip to content

Commit 27dab51

Browse files
committed
comment drizzle; more substitutions for from-seq; revert to v 0.9.0 of rxjava
1 parent 04e0993 commit 27dab51

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

rxjava/expt1/project.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
[org.slf4j/slf4j-log4j12 "1.7.5"]
1111
[enlive "1.1.1"]
1212
[org.clojure/data.json "0.2.2"]
13-
[com.netflix.rxjava/rxjava-core "0.9.1-SNAPSHOT"]
14-
[com.netflix.rxjava/rxjava-clojure "0.9.1-SNAPSHOT"]
15-
;; [com.netflix.rxjava/rxjava-clojure "0.9.0"]
13+
;; [com.netflix.rxjava/rxjava-core "0.9.1-SNAPSHOT"]
14+
;; [com.netflix.rxjava/rxjava-clojure "0.9.1-SNAPSHOT"]
15+
[com.netflix.rxjava/rxjava-clojure "0.9.0"]
1616
]
1717
:repositories {"local" ~(str (.toURI (java.io.File. "maven_repository")))}
1818
:main expt1.core)

rxjava/expt1/src/expt1/core.clj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
;; Use a promise for 'completed' so we can wait for it on
7474
;; another thread:
7575
onCompletedCollector (promise )]
76-
(letfn [;; When observable sends a value, relay it to our agent:
76+
(letfn [ ;; When observable sends a value, relay it to our agent:
7777
(collect-next [item] (send onNextCollector (fn [state] (conj state item))))
7878
;; If observable errors out, just set our exception;
7979
(collect-error [excp] (reset! onErrorCollector excp))
@@ -82,7 +82,7 @@
8282
;; In all cases, report out the back end with this:
8383
(report-collectors [ ]
8484
(identity ;; pdump
85-
{;; Wait at most 1 second for the promise to complete;
85+
{ ;; Wait at most "wait-time" for the promise to complete;
8686
;; if it does not complete, then produce 'false'. We
8787
;; must wait on the onCompleted BEFORE waiting on the
8888
;; onNext because the agent's await-for in onNext only
@@ -235,7 +235,7 @@
235235
;;; "distinctUntilChanged", but RxJava 0.9.0 doesn't seem to
236236
;;; have them yet. We can fake them as follows:
237237

238-
(-> (Observable/toObservable ["one" "two" "three"])
238+
(-> (from-seq ["one" "two" "three"])
239239
(.mapMany (comp from-seq string-explode))
240240

241241
;; The following two effect an implementation of "distinct".
@@ -258,7 +258,7 @@
258258
(.reduce #{} conj)
259259
(.mapMany from-seq)))
260260

261-
(-> (Observable/toObservable ["one" "two" "three"])
261+
(-> (from-seq ["one" "two" "three"])
262262
(.mapMany (comp from-seq string-explode))
263263
distinct
264264
subscribe-collectors
@@ -284,7 +284,7 @@
284284
;;; distinct-until-changed: we only need to remember one back. Still, to make
285285
;;; the point:
286286

287-
(-> (Observable/toObservable ["onnnnne" "tttwo" "thhrrrrree"])
287+
(-> (from-seq ["onnnnne" "tttwo" "thhrrrrree"])
288288
(.mapMany (comp from-seq string-explode))
289289

290290
;; The following two effect "distinctUntilChanged".
@@ -310,7 +310,7 @@
310310
;;; must be defined outside the mapMany and the function that mapMany applies.
311311
;;; However, this solution will not materialize the entire input sequence.
312312

313-
(let [exploded (-> (Observable/toObservable ["onnnnne" "tttwo" "thhrrrrree"])
313+
(let [exploded (-> (from-seq ["onnnnne" "tttwo" "thhrrrrree"])
314314
(.mapMany (comp from-seq string-explode)))
315315
;; Must define this container outside the mapMany and the function
316316
;; that napMany applies.
@@ -325,7 +325,7 @@
325325
(ref-set last-container [x])
326326
(return x)))))))
327327
subscribe-collectors
328-
pdump))
328+
pdump))
329329

330330
;;; Package and test:
331331

@@ -338,10 +338,10 @@
338338
(if (and l (= x l))
339339
(Observable/empty)
340340
(do
341-
(ref-set last-container [x])
341+
(ref-set last-container [x])
342342
(return x))))))))))
343343

344-
(-> (Observable/toObservable ["onnnnne" "tttwo" "thhrrrrree"])
344+
(-> (from-seq ["onnnnne" "tttwo" "thhrrrrree"])
345345
(.mapMany (comp from-seq string-explode))
346346
distinct-until-changed
347347
subscribe-collectors
@@ -350,7 +350,7 @@
350350

351351
;;; It's well-behaved on an empty input:
352352

353-
(-> (Observable/toObservable [])
353+
(-> (from-seq [])
354354
(.mapMany (comp from-seq string-explode))
355355
distinct-until-changed
356356
subscribe-collectors

0 commit comments

Comments
 (0)