Descartes, Berkeley

Functional Programming

and

A tree falls in the middle of a forest, but no one is there to hear it.

Does is make a sound?

class Tree {
    constructor(){
        this._fell = false;
    }

    set fell(state){
        this._fell = state;
    }

    get fell(){
        return this._fell;
    }
}

let tree = new Tree();

tree.fell = true;
class Tree extends EventEmitter {}

let tree = new Tree();

tree.emit("fall");

I think therefore

I am.

To be is to be perceived.

Object Oriented 

Functional Reactive

Encapsulated State

Causal chains

(1685 - 1753)

(1596 - 1650 )

class Air extends EventEmitter {
    constructor (){
        this.on('fall', function(tree){
            let frequency = this.map(tree)
            this.emit('vibrate', frequency)
        }.bind(this)
    }
    map (tree){
        ...
        return frequency
    }
}
class Ear extends EventEmitter (){
    constructor (){
        this.on('vibrate', function(freq){
            let stimulus = this.map(freq)
            this.emit('signal', signal)
        }.bind(this)
    }
    map (freq) {
        ...
        return stimulus
    }
}
class Brain extends EventEmitter (){
    constructor (){
        this.on('signal', function(stimulus){
            let sound = this.map(stimulus)
            this.emit('sound', sound)
        }.bind(this)
    }
    map (data){
        ...
        return sound
    }
}

FRP

If we don't perceive the tree, it makes no sound!


emit('fall')

emit('vibrate')

emit('stimulus')

emit('sound')

Subscription pipeline:

Data and event flow:

brain.subscribe(ear).subscribe(air).subscribe(tree)

map

map

map

It is indeed an opinion strangely prevailing amongst men, that houses, mountains, rivers, and in a word all sensible objects have an existence natural or real, distinct from their being perceived by the understanding. ...For what are the forementioned objects but the things we perceive by sense...and is it not plainly repugnant that any one of these or any combination of them should exist unperceived? 

Reality

- George Berkeley

Berkeley called this Subjective Idealism

map

map

map

False Idols!

Enough philosophy.

Why does this matter?

Space

Time

You don't experience the past

You don't experience

what you can't see

  • Ray-tracing
  • Infinite Scrollview
  • Lazy Loading
  • Diffing / dirty checking
infinite
    .primes()
    .filter((i) => {return i > 1000})
    .take(5)

// [1009, 1013, 1019, 1021, 1031]

Compute

data

subscribed maps

data flow

var data = {foo : 'bar'};

source.emit('update', data);
domElement.subscribe(map1)
          .subscribe(map2)
          ...    
          .subscribe(source);
var element = document.createElement('div');
var mounted = false;

domElement.on('update', function(data){
    if (!mounted) {
        document.body.appendChild(element);
        mounted = true;
    }
    element.innerHTML = data.foo;
});
var element = document.createElement('div');
var mounted = false;

domElement.on('update', function(data){
    if (!mounted) {
        document.body.appendChild(element);
        mounted = true;
    }
    element.innerHTML = data.foo;
});

// view is off-screen. don't update DOM.
domElement.off('update');

SubjectiveIdealism.js

How complicated of a system can we build with

SubjectiveIdealism.js?

map

(Lagrangian for the Standard Model of particle physics)

state

Perhaps your understanding of

 

the nature of reality

 

needs a cache invalidation!

  • @dmvaldman
  • We're hiring! Help us build AI-powered checkout at

Thank you WaffleJS!

Shameless Plugs:

standard.ai

Made with Slides.com