Skip to content

Commit

Permalink
seq->o should seq-ify arg
Browse files Browse the repository at this point in the history
  • Loading branch information
daveray committed Feb 25, 2014
1 parent 7919c04 commit d19bc42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@
(defn ^Observable seq->o
"Make an observable out of some seq-able thing. The rx equivalent of clojure.core/seq."
[xs]
(if xs
(Observable/from ^Iterable xs)
(if-let [s (clojure.core/seq xs)]
(Observable/from ^Iterable s)
(empty)))

;################################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
(deftest test-seq->o
(is (= [] (b/into [] (rx/seq->o []))))
(is (= [] (b/into [] (rx/seq->o nil))))
(is (= [\a \b \c] (b/into [] (rx/seq->o "abc"))))
(is (= [0 1 2 3] (b/first (rx/into [] (rx/seq->o (range 4))))))
(is (= #{0 1 2 3} (b/first (rx/into #{} (rx/seq->o (range 4))))))
(is (= {:a 1 :b 2 :c 3} (b/first (rx/into {} (rx/seq->o [[:a 1] [:b 2] [:c 3]]))))))
Expand Down

0 comments on commit d19bc42

Please sign in to comment.