import Cycle from '@cycle/core';
import {h, makeDOMDriver} from '@cycle/dom';

function main({DOM}) {
  const action$ = Cycle.Rx.Observable.merge(
    DOM.get('.decrement', 'click').map(() => -1),
    DOM.get('.increment', 'click').map(() => +1)
  );

  const count$ = action$.startWith(0).scan((x, y) => x + y);

  return {
    DOM: count$.map(count =>
        h('div', [
          h('button.decrement', 'Decrement'),
          h('button.increment', 'Increment'),
          h('p', 'Counter: ' + count)
        ])
      )
  };
}

Cycle.run(main, {
  DOM: makeDOMDriver('#app')
});

@@ -107,173 +107,240 @@
 nst 
-action$ = Cycle.Rx.Observable.merge(%0A    DOM.get('.decrement', 'click')
+changeWeight$ = DOM.get('#weight', 'input')%0A    
 .map(
-()
+ev
  =%3E 
--1),%0A    DOM.get('.increment', 'click')
+ev.target.value);%0A%0A  const changeHeight$ = DOM.get('#height', 'input')%0A    
 .map(
-()
+ev
  =%3E 
-+1)%0A  );%0A%0A  const count$ = action
+ev.target.value);%0A%0A  const state$ = Cycle.Rx.Observable.combineLatest(%0A    changeWeight
 $.st
@@ -351,31 +351,230 @@
 ith(
+7
 0)
-.scan((x, y) =%3E x + y
+,%0A    changeHeight$.startWith(170),%0A    (weight, height) =%3E %7B%0A      const heightMeters = height * 0.01;%0A      const bmi = Math.round(weight / (heightMeters * heightMeters));%0A%0A      return %7Bweight, height, bmi%7D;%0A    %7D%0A  
 );%0A%0A
@@ -597,30 +597,46 @@
 OM: 
-count
+state
 $.map(
-count
+(%7Bweight, height, bmi%7D)
  =%3E%0A
-  
     
@@ -660,128 +660,281 @@
     
-  
 h('
-button.decrement', 'Decrement'),%0A          h('button.increment', 'Increment'),%0A          h('p', 'Counter: ' + count
+div', %5B%0A          'Weight ' + weight + 'kg',%0A          h('input#weight', %7Btype: 'range', min: 40, max: 140, value: weight%7D)%0A        %5D),%0A        h('div', %5B%0A          'Height ' + height + 'cm',%0A          h('input#height', %7Btype: 'range', min: 140, max: 210, value: height%7D
 )%0A  
@@ -941,19 +941,60 @@
       %5D)
+,
 %0A  
+      h('h2', 'BMI is ' + bmi)%0A      %5D)%0A
     )%0A  

Add BMI example