FRP
Functional Reactive Programming
– Conal Elliott and Paul Hudak [1997]
“Functional Reactive Animation”
Philip Roberts: Enemy of the state:An introduction to Functional
Reactive Programming and Bacon.js
BITCH PLEASE
TL;DR
TERMINOLOGY
• Observer (Observable)	

• EventStream	

• Behaviour	

• Signal
INTERFACE
/**

* Represents a push-style collection.

*/

function Observable(subscribe) {

this.subscribe = subscribe;

};

Observable.prototype.subscribe = function(onNext, onError, onCompleted) {};



/**

* Supports push-style iteration over an observable sequence.

*/

function Observer(onNext, onError, onCompleted) {

this.onNext = onNext;

this.onError = onError;

this.onCompleted = onCompleted;

}

Observer.prototype.onNext = function(value) {};

Observer.prototype.onError = function(exception) {};

Observer.prototype.onCompleted = function() {};
RXJS
The Reactive Extensions for
JavaScript
BACON.JS
The most delicious JavaScript
library
Feature RxJS Bacon.js
Creating an observable sequence ✓ ✓
Converting events or asynchronous patterns to observable sequences, or between
Arrays and observable sequences. ✓ ✓
Combining multiple observable sequences into a single sequence. ✓ ✓
Functional ✓ ✗
Mathemathical operators on sequences ✓ ✗
Time-based operations ✓ ✓
Handling Exceptions ✓ ✗
Filtering and selecting values in a sequence ✓ ✓
Grouping and Windowing ✓ ✓
Imperative Operators ✓ ✗
Primitives ✓ ✓
THAT’S IT?
• Async.js is a clean, composable way to manipulate
sequences of values with asynchronous functions	

• Flapjax is a new programming language designed around
the demands of modern, client-based Web applications	

• Javelin is a spreadsheet-like dataflow programming in
ClojureScript	

• And lots of wrappers around everything…
DEMO
README
Libraries:	

• http://reactive-extensions.github.io/RxJS/	

• http://baconjs.github.io/	

• https://github.com/fjakobs/async.js	

!
Courses:	

• https://coursera.org/course/reactive	

!
Videos:	

• http://vimeo.com/68987289	

!
Papers:	

• http://conal.net/papers/icfp97/	

• http://conal.net/fran/tutorial.htm
THANKS

FRP

  • 1.
  • 2.
    – Conal Elliottand Paul Hudak [1997] “Functional Reactive Animation”
  • 3.
    Philip Roberts: Enemyof the state:An introduction to Functional Reactive Programming and Bacon.js
  • 4.
  • 5.
  • 6.
    TERMINOLOGY • Observer (Observable) •EventStream • Behaviour • Signal
  • 7.
    INTERFACE /**
 * Represents apush-style collection.
 */
 function Observable(subscribe) {
 this.subscribe = subscribe;
 };
 Observable.prototype.subscribe = function(onNext, onError, onCompleted) {};
 
 /**
 * Supports push-style iteration over an observable sequence.
 */
 function Observer(onNext, onError, onCompleted) {
 this.onNext = onNext;
 this.onError = onError;
 this.onCompleted = onCompleted;
 }
 Observer.prototype.onNext = function(value) {};
 Observer.prototype.onError = function(exception) {};
 Observer.prototype.onCompleted = function() {};
  • 8.
  • 9.
    BACON.JS The most deliciousJavaScript library
  • 10.
    Feature RxJS Bacon.js Creatingan observable sequence ✓ ✓ Converting events or asynchronous patterns to observable sequences, or between Arrays and observable sequences. ✓ ✓ Combining multiple observable sequences into a single sequence. ✓ ✓ Functional ✓ ✗ Mathemathical operators on sequences ✓ ✗ Time-based operations ✓ ✓ Handling Exceptions ✓ ✗ Filtering and selecting values in a sequence ✓ ✓ Grouping and Windowing ✓ ✓ Imperative Operators ✓ ✗ Primitives ✓ ✓
  • 11.
    THAT’S IT? • Async.jsis a clean, composable way to manipulate sequences of values with asynchronous functions • Flapjax is a new programming language designed around the demands of modern, client-based Web applications • Javelin is a spreadsheet-like dataflow programming in ClojureScript • And lots of wrappers around everything…
  • 12.
  • 13.
    README Libraries: • http://reactive-extensions.github.io/RxJS/ • http://baconjs.github.io/ •https://github.com/fjakobs/async.js ! Courses: • https://coursera.org/course/reactive ! Videos: • http://vimeo.com/68987289 ! Papers: • http://conal.net/papers/icfp97/ • http://conal.net/fran/tutorial.htm
  • 14.