Book Image

Clojure Reactive Programming

Book Image

Clojure Reactive Programming

Overview of this book

Table of Contents (19 chapters)
Clojure Reactive Programming
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Bibliography
Index

Building a stock market monitoring application


Our stock market program will consist of three main components:

  • A function simulating an external service from which we can query the current price—this would likely be a network call in a real setting

  • A scheduler that polls the preceding function at a predefined interval

  • A display function responsible for updating the screen

We'll start by creating a new leiningen project, where the source code for our application will live. Type the following on the command line and then switch into the newly created directory:

lein new stock-market-monitor
cd stock-market-monitor

As we'll be building a GUI for this application, go ahead and add a dependency on Seesaw to the dependencies section of your project.clj:

[seesaw "1.4.4"]

Next, create a src/stock_market_monitor/core.clj file in your favorite editor. Let's create and configure our application's UI components:

(ns stock-market-monitor.core
  (:require [seesaw.core :refer :all])
  (:import (java.util.concurrent...