Removing incidental complexity with RxClojure
In Chapter 2, A Look at Reactive Extensions, we learned about the basic building blocks of RxClojure, an open-source CES framework. In this section, we'll use this knowledge in order to remove the incidental complexity from our program. This will give us a clear, declarative way to display both prices and rolling averages.
The UI code we've written so far remains unchanged, but we need to make sure RxClojure is declared in the dependencies section of our project.clj
file:
[io.reactivex/rxclojure "1.0.0"]
Then, ensure we require the following library:
(ns stock-market-monitor.core (:require [rx.lang.clojure.core :as rx] [seesaw.core :refer :all]) (:import (java.util.concurrent TimeUnit) (rx Observable)))
The way we approach the problem this time is also different. Let's take a look at the first requirement: it requires we display the current price of a company's share in the stock market.
Every...