File tree Expand file tree Collapse file tree 4 files changed +24
-8
lines changed
language-adaptors/rxjava-clojure/src/main/clojure/rx/lang/clojure Expand file tree Collapse file tree 4 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 14
14
(set! *warn-on-reflection* true )
15
15
16
16
(defmacro ^:private with-ex-unwrap
17
+ " The blocking ops wrap errors stuff in RuntimeException because of stupid Java.
18
+ This tries to unwrap them so callers get the exceptions they expect."
17
19
[& body]
18
20
`(try
19
21
~@body
80
82
(defn single
81
83
" *Blocks* and waits for the first value emitted by the given observable.
82
84
83
- An error is thrown if more then one value is produced.
85
+ An error is thrown if zero or more then one value is produced.
84
86
"
85
87
[observable]
86
88
(with-ex-unwrap
Original file line number Diff line number Diff line change 6
6
(set! *warn-on-reflection* true )
7
7
8
8
(defn chunk
9
- " Same as rx.Observable.merge(Observable<Observable<T>>) but the input Observables
9
+ " EXTREMELY EXPERIMENTAL AND SUBJECT TO CHANGE OR DELETION
10
+
11
+ TODO RxJava's much bigger since this was written. Is there something built in?
12
+
13
+ Same as rx.Observable.merge(Observable<Observable<T>>) but the input Observables
10
14
are \" chunked\" so that at most chunk-size of them are \" in flight\" at any given
11
15
time.
12
16
19
23
Example:
20
24
21
25
(->> users
22
- (map #(-> (GetUserCommand. %) .toObservable))
26
+ (rx/ map #(-> (GetUserCommand. %) .toObservable))
23
27
(chunk 10))
24
28
25
29
See:
Original file line number Diff line number Diff line change 18
18
(.cache o)))
19
19
20
20
(defn let-o*
21
- " Given a graph description, returns an observable that emits a single
21
+ " EXTREMELY EXPERIMENTAL AND SUBJECT TO CHANGE OR DELETION
22
+
23
+ Given a graph description, returns an observable that emits a single
22
24
map of observables all hooked up and ready for subscription.
23
25
24
26
A graph is a map from name to a map with keys:
73
75
(assoc ::non-terminals non-terminals))))
74
76
75
77
(defmacro let-o
76
- " Similar to clojure.core/let, but bindings are Observables and the result of the body
78
+ " EXTREMELY EXPERIMENTAL AND SUBJECT TO CHANGE OR DELETION
79
+
80
+ Similar to clojure.core/let, but bindings are Observables and the result of the body
77
81
must be an Observable. Binding names must start with ?. Binding order doesn't matter
78
82
and any binding is visible to all other expressions as long as no cycles are produced
79
83
in the resulting Observable expression.
Original file line number Diff line number Diff line change 34
34
:else (->post-proc (rx.Observable/just v))))
35
35
36
36
(defn realized-map
37
- " See let-realized.
37
+ " EXTREMELY EXPERIMENTAL AND SUBJECT TO CHANGE OR DELETION
38
+
39
+ See let-realized.
38
40
39
41
Given a map from key to observable, returns an observable that emits a single
40
42
map from the same keys to the values emitted by their corresponding observable.
92
94
(.reduce {} (iop/fn* merge))))) ; do the map merge dance
93
95
94
96
(defn ^rx.Observable realized-map*
95
- " Same as realized-map, but takes a map argument rather than key-value pairs."
97
+ " EXTREMELY EXPERIMENTAL AND SUBJECT TO CHANGE OR DELETION
98
+
99
+ Same as realized-map, but takes a map argument rather than key-value pairs."
96
100
[map-description]
97
101
(apply realized-map (apply concat map-description)))
98
102
99
103
(defmacro let-realized
100
- " 'let' version of realized map.
104
+ " EXTREMELY EXPERIMENTAL AND SUBJECT TO CHANGE OR DELETION
105
+
106
+ 'let' version of realized map.
101
107
102
108
(let-realized [a (make-observable)]
103
109
(* 2 a))
You can’t perform that action at this time.
0 commit comments