An RxScala example

This is a little RxScala example from the RxScala/RxJava Github docs:

object Transforming extends App
{
    /**
     * Asynchronously calls 'customObservableNonBlocking'
     * and defines a chain of operators to apply to the 
     * callback sequence.
     */
    def simpleComposition()
    {
        AsyncObservable.customObservableNonBlocking()
            .drop(10)
            .take(5)
            .map(stringValue => stringValue + "_xform")
            .subscribe(s => println("onNext => " + s))
    }

    simpleComposition()
}

If you like visual diagrams, this source code goes along with this marble diagram.

I’ll be including examples like this in my book, Functional Programming, Simplified.