(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
I'm not suggesting drastic action. I don't want to break backwards compatibility. I simply want to make the class feature more usable to a broader cross section of the community. I believe there is some low-hanging fruit that can be harvested to that end.
Imagine AutoMaker contained class Car, but the author wants to take advantage of prototypes to enable factory polymorphism in order to dynamically swap out implementation.
Stampit does something similar to this in order to supply information needed to inherit from composable factory functions, known as stamps.
This isn't the only way to achieve this, but it is a convenient way which is compatible with .call(), .apply(), and .bind().
| import React from 'react'; | |
| import component from 'omniscient'; | |
| import immstruct from 'immstruct'; | |
| import { compose, valueNode, partialProps } from './compose'; | |
| const data = immstruct({ counter: 0, title: 'My title' }); | |
| const em = component(({partialedTitle, children}) => | |
| <em>{partialedTitle}: {children}</em>); |
| # avoid "works on my machine" by always locking dependency versions | |
| npm config set save-exact=true | |
| # install/uninstall project packages with flags that will update package.json | |
| npm install --save lodash | |
| npm install --save-dev jshint | |
| npm uninstall --save lodash | |
| # tool that makes upgrading dependencies easier, install it globally | |
| npm install -g david |
| #!/bin/bash | |
| set -e | |
| if ([ "$1" == "install" ] || [ "$1" == "i" ]) && [ "$#" -ne 1 ]; then | |
| for var in "$@" | |
| do | |
| if [ "$var" == "--save" ] || [ "$var" == "--save-dev" ] || [ "$var" == "-S" ] || [ "$var" == "-D" ] || [ "$var" == "-g" ]; then | |
| has_modifier=true | |
| fi |
| const I = x => x | |
| const K = x => y => x | |
| const A = f => x => f (x) | |
| const T = x => f => f (x) | |
| const W = f => x => f (x) (x) | |
| const C = f => y => x => f (x) (y) | |
| const B = f => g => x => f (g (x)) | |
| const S = f => g => x => f (x) (g (x)) | |
| const S_ = f => g => x => f (g (x)) (x) | |
| const S2 = f => g => h => x => f (g (x)) (h (x)) |
| // NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension | |
| { | |
| // Settings | |
| "passfail" : false, // Stop on first error. | |
| "maxerr" : 100, // Maximum error before stopping. | |
| // Predefined globals whom JSHint will ignore. | |
| "browser" : true, // Standard browser globals e.g. `window`, `document`. |
| const daggy = require('daggy') | |
| const compose = (f, g) => x => f(g(x)) | |
| const id = x => x | |
| //===============Define Coyoneda========= | |
| const Coyoneda = daggy.tagged('x', 'f') | |
| Coyoneda.prototype.map = function(f) { | |
| return Coyoneda(this.x, compose(f, this.f)) | |
| } |