reducer for the counter
@param  {number} state  input state
@param  {object} action object containing the action type
@param  {string} action.type action type
@return {number}
323724
function counter(state = 0, action = {}) {
  switch (action.type) {
    case INCREMENT_COUNTER:
      return state + 1;
    case DECREMENT_COUNTER:
      return state - 1;
    default:
      return state;
  }
}
95956
def actions(self, state):
        ''''''
        rows = string_to_list(state)
        row_e, col_e = find_location(rows, 'e')

        actions = []
        if row_e > 0:
            actions.append(rows[row_e - 1][col_e])
        if row_e < 2:
            actions.append(rows[row_e + 1][col_e])
        if col_e > 0:
            actions.append(rows[row_e][col_e - 1])
        if col_e < 2:
            actions.append(rows[row_e][col_e + 1])

        return actions
997582
function copifyReducer(reducer) {
  return (state, action) => {
    // every action has a specific key
    const { key } = action
    // MAYBE it's redux INIT action when in combineReducers, state is undefined
    // and reducer(state, action) will generate defaultState
    if (key === undefined) {
      /*
       * everytime when combineReducer is called, we receive a INIT action
       * we need the next line, or state will change to shape like
       * {
       *   DEFAULT_STATE_STORE_KEY: {
       *     DEFAULT_STATE_STORE_KEY: {
       *       DEFAULT_STATE_STORE_KEY: {
       *         ...state
       *     }
       *    }
       *   }
       */
      if ( !(DEFAULT_STATE_STORE_KEY in (state || {}/* INIT action, state is undefined */)) ) {
        return { [DEFAULT_STATE_STORE_KEY]: reducer(state, action) }
      }
      return state
    }

    // when encount a key doesn't exist, init scope state for it
    if ( !(key in state) ) {
      state = {
        ...state,
        [key]: cloneDeep( state[DEFAULT_STATE_STORE_KEY] )
      }
    }
    return {
      ...state,
      [key]: reducer(state[key], action)
    }
  }
}
1240919
function getStack (state, list, resource, action) {
  const handleName = [ resource.name, action.name ].join('!')
  const stack = state.snap.stack(handleName)
  _.each(list, function (propertySpec) {
    const property = getProperty(state.config.service || {}, resource, action, propertySpec)
    if (property.value) {
      addMiddleware(state, stack, property.value, property.key)
    }
  })
  return stack
}
865285
function modelRootReducer() {
        var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : modelInitState;
        var action = arguments.length > 1 ? arguments[1] : undefined;
        return (0, _immer.default)(state, function (draft) {
          var caseReducer = modelReducers[action.type];

          if (caseReducer) {
            return caseReducer(draft, action);
          }

          return draft;
        });
      }
1353573
private ParsingState.Action getAction(int l, int r, int[] heads) {
		if (heads[l] == r && modifierNumOf(l, heads) == 0)
			return ParsingState.Action.RIGHT;
		if (heads[r] == l && modifierNumOf(r, heads) == 0)
			return ParsingState.Action.LEFT;
		return ParsingState.Action.SHIFT;
	}
432031
function start (action, state) {
  initBuffer()
  if (__DEBUG__) {
    if (console.group) {
      displayBuffer.header = ['%credux-undo', 'font-style: italic', 'action', action.type]
      displayBuffer.action = colorFormat('action', colors.action, action)
      displayBuffer.prev = colorFormat('prev history', colors.prevState, state)
    } else {
      displayBuffer.header = ['redux-undo action', action.type]
      displayBuffer.action = ['action', action]
      displayBuffer.prev = ['prev history', state]
    }
  }
}
30894
function reviewsByHash(state = {}, action) {
  switch (action.type) {
    case REQUEST_REVIEWS:
      return {
        ...state,
        [action.hash]: {
          ...state[action.hash],
          isFetching: true,
          expires: 0,
        },
      };
    case RECEIVE_REVIEWS: {
      const reviews = state[action.hash].reviews || {};
      const nextReviews = action.reviews || [];

      /**
       * If there are no previous reviews and no incoming reviews
       * its set to empty array, otherwise it will be an array of the previous and the
       * new reviews. Duplicates are removed.
       */
      const stateReviews = (reviews || nextReviews.length) ? uniq([
        ...reviews,
        ...nextReviews.map(review => review.id),
      ]) : [];

      return {
        ...state,
        [action.hash]: {
          ...state[action.hash],
          reviews: stateReviews,
          totalReviewCount: action.totalReviewCount || null,
          isFetching: false,
          expires: Date.now() + REVIEWS_LIFETIME,
        },
      };
    }
    case ERROR_REVIEWS:
      return {
        ...state,
        [action.hash]: {
          ...state[action.hash],
          isFetching: false,
          expires: 0,
        },
      };
    default:
      return state;
  }
}
643570
function callReducers(actionName, actionData) {
    this.reducers.forEach(item => {
        this.state[item.stateKey] = item.reducer(this.state[item.stateKey], actionName, actionData);
    });
}
1056708
function FindActions()
    {
        /* Add all of the reduce actions 
        ** A reduce action is added for each element of the followset of
        ** a configuration which has its dot at the extreme right.
        */
        for ($i = 0; $i < $this->nstate; $i++) {   /* Loop over all states */
            $stp = $this->sorted[$i]->data;
            for ($cfp = $stp->cfp; $cfp; $cfp = $cfp->next) {
                /* Loop over all configurations */
                if ($cfp->rp->nrhs == $cfp->dot) {        /* Is dot at extreme right? */
                    for ($j = 0; $j < $this->nterminal; $j++) {
                        if (isset($cfp->fws[$j])) {
                            /* Add a reduce action to the state "stp" which will reduce by the
                            ** rule "cfp->rp" if the lookahead symbol is "$this->symbols[j]" */
                            PHP_ParserGenerator_Action::Action_add($stp->ap, PHP_ParserGenerator_Action::REDUCE,
                                                    $this->symbols[$j], $cfp->rp);
                        }
                    }
                }
            }
        }

        /* Add the accepting token */
        if ($this->start instanceof PHP_ParserGenerator_Symbol) {
            $sp = PHP_ParserGenerator_Symbol::Symbol_find($this->start);
            if ($sp === 0) {
                $sp = $this->rule->lhs;
            }
        } else {
            $sp = $this->rule->lhs;
        }
        /* Add to the first state (which is always the starting state of the
        ** finite state machine) an action to ACCEPT if the lookahead is the
        ** start nonterminal.  */
        PHP_ParserGenerator_Action::Action_add($this->sorted[0]->data->ap, PHP_ParserGenerator_Action::ACCEPT, $sp, 0);
    
        /* Resolve conflicts */
        for ($i = 0; $i < $this->nstate; $i++) {
    //    struct action *ap, *nap;
    //    struct state *stp;
            $stp = $this->sorted[$i]->data;
            if (!$stp->ap) {
                throw new Exception('state has no actions associated');
            }
            echo 'processing state ' . $stp->statenum . " actions:\n";
            for ($ap = $stp->ap; $ap !== 0 && $ap->next !== 0; $ap = $ap->next) {
                echo '  Action ';
                $ap->display(true);
            }
            $stp->ap = PHP_ParserGenerator_Action::Action_sort($stp->ap);
            for ($ap = $stp->ap; $ap !== 0 && $ap->next !== 0; $ap = $ap->next) {
                for ($nap = $ap->next; $nap !== 0 && $nap->sp === $ap->sp ; $nap = $nap->next) {
                    /* The two actions "ap" and "nap" have the same lookahead.
                    ** Figure out which one should be used */
                    $this->nconflict += $this->resolve_conflict($ap, $nap, $this->errsym);
                }
            }
        }
    
        /* Report an error for each rule that can never be reduced. */
        for ($rp = $this->rule; $rp; $rp = $rp->next) {
            $rp->canReduce = false;
        }
        for ($i = 0; $i < $this->nstate; $i++) {
            for ($ap = $this->sorted[$i]->data->ap; $ap !== 0; $ap = $ap->next) {
                if ($ap->type == PHP_ParserGenerator_Action::REDUCE) {
                    $ap->x->canReduce = true;
                }
            }
        }
        for ($rp = $this->rule; $rp !== 0; $rp = $rp->next) {
            if ($rp->canReduce) {
                continue;
            }
            PHP_ParserGenerator::ErrorMsg($this->filename, $rp->ruleline, "This rule can not be reduced (is not connected to the start symbol).\n");
            $this->errorcnt++;
        }
    }
707439
function app(state = {}, action) {
  switch (action.type) {
    case CHANGE_BAZ:
      return {
        ...state,
        baz: action.payload,
      };
    default:
      return state;
  }
}
177254
function initWithActions (actionType, actions) {
    var prev = actions[0].copy()
      , now
      , i
    for (i=1; i<actions.length; i++) {
        now = actions[i].copy()
        if (now) {
            prev = new actionType({one: prev, two: now})
        } else {
            break
        }
    }

    return prev
}
1194952
function slimReduxReducer(state, action) {
  var actionType = action.type,
      payload = action.payload,
      isError = action.error,
      store = this,
      reducer = store.slimRedux.changeTriggers[actionType] ? store.slimRedux.changeTriggers[actionType].reducer : null;

  if (reducer && !isError) return reducer(state, payload, action);else return state;
}
691472
function isCounterAfter(counter, currentStateCounter)
{
	const diff = counter - currentStateCounter

	// If the new options are "newer" than the current ones,
	// then they can override them.
	// (also accounts for counter overflow)
	return diff > 0 || (diff < 0 && Math.abs(diff) > MAX_SAFE_INTEGER / 2)
}
334294
Action transform(int act)
    {
        if (act == 0)
        {
            return ActionFactory.make_shift();
        }
        else if (act < 1 + L)
        {
            return ActionFactory.make_left_arc(act - 1);
        }
        else if (act < 1 + 2 * L)
        {
            return ActionFactory.make_right_arc(act - 1 - L);
        }
        else
        {
            System.err.printf("unknown transition in transform(int): %d", act);
        }
        return new Action();
    }
108474
function _createAction(action) {
  if (_isString(action)) {
    action = {
      destination: action,
    }
  }
  if (_isObject(action)) {
    action = (function() {
      const openNewTab = action.openNewTab
      const destination = action.destination
      return function() {
        if (openNewTab) {
          window.open(destination, '_blank')
        } else {
          window.location.href = destination
        }
      }
    })()
  }

  return action
}
1280016
function createRootReducer (container, ...reducers) {
  return (state = {}, action = {}) => {
    const identifiers = ensureContainerStateIdentifiers(container)
    const domElement = container[$domElement]
    const template = getTemplateFromDomElement(domElement)
    const middleware = container[$middleware].entries()
    const isBody = domElement == document.body

    if (action.data) {
      state = extend(state, action.data)
    }

    /**
     * Loops over each pipe function
     * providing state and action values
     * given to use from redux.
     *
     * @private
     */

    const reducerSet = new Set([ ...reducers ])
    const reducerEntires = reducerSet.entries()
    reduce()
    function reduce () {
      const step = reducerEntires.next()
      const done = step.done
      const reducer = step.value ? step.value[1] : null
      if (done) return
      const newState = reducer(state, action)
      if (null != newState)
        state = newState
      reduce()
    }

    if ($UPDATE_ACTION == action.type) {

      /**
       * Loops over each middleware function
       * providing state and action values
       * given to use from redux.
       *
       * @private
       */

      void function next () {
        const step = middleware.next()
        const done = step.done
        const reducer = step.value ? step.value[0] : null
        if (done) return
        else if (null == reducer) next()
        else if (false === reducer(state, action)) return
        else next()
      }()

      container.define(state)

      if (!isBody && identifiers) {
        const parser = new Parser()
        const partial = new Template(template)
        const src = partial.render(container.state, container)
        const patch = parser.createPatch(src)
        patch(domElement)
      }
    }

    return state
  }
}