src/Fun.js
function observeArgs(args, run) {

  function observeArg(arg, i, args) {
    var observer = Observer(
      arg,
      function argObserver(changes) {
        changes.forEach(({type, newValue}) => {
          if (type === 'upward') {
            args[i] = newValue;
            observer.reobserve(newValue);
          }
        });

        run();
      },
      // @TODO: consider whether to check for D/A/U here, or use 'modify' change type
      ['upward', 'delete', 'add', 'update'] // @TODO: check all these are necessary
    );
    observer.observe();
  }

  args.forEach(observeArg);
}
function observeArgs(args, run) {

  function observeArg(arg, i, args) {
    var observer = Observer(
      arg,
      function argObserver(changes) {
        changes.forEach(({type, newValue}) => {
          if (type === 'upward') {
            args[i] = newValue;
            observer.reobserve(newValue);
          }
        });

        run();
      },
      // @TODO: consider whether to check for D/A/U here, or use 'modify' change type
      ['upward', 'delete', 'add', 'update'] // @TODO: check all these are necessary
    );
    observer.observe();
  }

  args.forEach(observeArg);
}
function observeArgs ( args , run ) { function observeArg ( arg , i , args ) { var observer = Observer ( arg , function argObserver ( changes ) { changes . forEach ( ( { type , newValue } ) => { if ( type === 'upward' ) { args [ i ] = newValue ; observer . reobserve ( newValue ) ; } } ) ; run ( ) ; } , // @TODO: consider whether to check for D/A/U here, or use 'modify' change type [ 'upward' , 'delete' , 'add' , 'update' ] // @TODO: check all these are necessary ) ; observer . observe ( ) ; } args . forEach ( observeArg ) ; }
Observe changes to arguments. This will handle 'compute' changes, and trigger recomputation of function. When args changes, the new value is reobserved.
Observe changes to arguments . This will handle compute changes and trigger recomputation of function . When args changes the new value is reobserved .