Created
February 13, 2013 01:07
-
-
Save daveray/4784716 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn ^Observable drop-while | |
[f ^Observable xs] | |
(Observable/create (fn [^Observable subject] | |
(let [dropping (atom true) | |
subscription (subscribe* xs | |
(fn [v] | |
(when (or (not @dropping) | |
(not (reset! dropping (boolean (f v))))) | |
(emit subject v))) | |
(fn [e] (error subject e)) | |
(fn [] (done subject)))] | |
(Observable/createSubscription #(unsubscribe subscription)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment