Global State aka No More Stores, Part 3: FRP && ReactJS

An app written in the functional-programming style has no clear way of storing state—functions are not supposed to store state between successive calls (in an imperative way, like using an object variable.)

A common approach in FP for solving the state problem is global state—a data structure represents the global state. Top-level functions operate on the global state.
As we’ll see, in contrast to Action Streams, this approach diverges from the Flux architecture. Continue reading


Stores as Stream Observers, Part 2: FRP && ReactJS

How the heck can stores “hold” state in FRP?

Before we talk about how Stores look like in functional reactive programming (FRP), we need to discuss how Stores can even store/manage state in FRP. Technically speaking, in functional programming (FP), functions are not supposed to store state between successive calls.

Continue reading


Functional Reactive Programming in JS, the 10,000ft Overview

I’ve spent the past year working with functional reactive programming (FRP). Some of the problems I’ve noticed is that most of the online resources either:

  • assumes you already know what FRP is
  • assumes you won’t create anything more complex than a toy app
  • focuses on the “reactive” part, ignoring the functional programming

Let’s fix that by answering, “What is functional programming (FP)?””
Continue reading


How to Implement the Backpropagation Algorithm

Unfortunately, typesetting math in is painful, painful, painful
So instead battling WordPress, I’m gonna use my notebook for this post.

As usual, there is code!

(Oh and as of 12/8/2013, my notebook is visually ugly. Will style it later.)


Table Joins/Unions and ContentProviders: Reminderer

Ever since I wrote the new ContentProvider framework, Reminderer had this annoying bug where it wouldn’t auto-refresh the open tasks list whenever you added a new task. You added a task but the darn task wouldn’t show on the list until you rotated the phone.

The first approach was to force reload the Loader every time the fragment gets focus. While this hack works, its just that—a hack. This approach quickly becomes inefficient once the task list gets unduly large (as in hundreds of tasks). The second approach was to use a ContentObserver to listen for changes in the database. Fortunately, for some reason, as I’ll explain shortly, the content observer wouldn’t listen to changes in the table.

Continue reading