public function step($result, $input) { if (call_user_func($this->pred, $input)) { return $this->xf->step($result, $input); } else { return $result; } }
public function step($result, $input) { if (call_user_func($this->pred, $input)) { return $this->xf->step($result, $input); } else { return Transducers::reduced($result); } }
public function step($result, $input) { $ret = $this->xf->step($result, $input); if (Transducers::isReduced($ret)) { return Transducers::reduced($ret); } return $ret; }
public function step($result, $input) { $v = call_user_func($this->f, $input); if ($v === null) { return $result; } else { return $this->xf->step($result, $v); } }
public function step($result, $input) { if ($this->n > 0) { $this->n -= 1; return $result; } else { return $this->xf->step($result, $input); } }
public function step($result, $input) { $this->i += 1; if ($this->i % $this->n === 0) { return $this->xf->step($result, $input); } else { return $result; } }
public function step($result, $input) { if ($this->n > 0) { $result = $this->xf->step($result, $input); } else { $result = Transducers::ensureReduced($result); } $this->n -= 1; return $result; }
public function step($result, $input) { if ($this->drop && call_user_func($this->pred, $input)) { return $result; } else { if ($this->drop) { $this->drop = false; } return $this->xf->step($result, $input); } }
public function step($result, $input) { $this->a[] = $input; if (count($this->a) === $this->n) { $a = $this->a; $this->a = []; return $this->xf->step($result, $a); } else { return $result; } }
public static function reduce($coll, TransformerInterface $xf, $init) { $result = $init; foreach ($coll as $key => $value) { $result = $xf->step($result, new Pair([$key, $value])); if (Transducers::isReduced($result)) { $result = Transducers::deref($result); break; } } return $xf->result($result); }
public static function reduceArray($coll, TransformerInterface $xf, $init) { $result = array_reduce($coll, function ($result, $input) use($xf) { if (Transducers::isReduced($result)) { return $result; } return $xf->step($result, $input); }, $init); if (Transducers::isReduced($result)) { $result = Transducers::deref($result); } return $xf->result($result); }
public static function reduce($coll, TransformerInterface $xf, $init) { $result = $init; while (!feof($coll)) { $item = fgets($coll, 8196); $result = $xf->step($result, $item); if (Transducers::isReduced($result)) { $result = Transducers::deref($result); break; } } return $xf->result($result); }
public static function reduce($coll, TransformerInterface $xf, $init) { $result = $init; $length = strlen($coll); for ($i = 0; $i < $length; $i += 1) { $result = $xf->step($result, $coll[$i]); if (Transducers::isReduced($result)) { $result = Transducers::deref($result); break; } } return $xf->result($result); }
public function step($result, $input) { $pval = $this->pval; $val = call_user_func($this->f, $input); $this->pval = $val; $none = Transducers::none(); if ($pval === $none || $pval === $val) { $this->a[] = $input; return $result; } $ret = $this->xf->step($result, $this->a); $this->a = []; if (!Transducers::isReduced($ret)) { $this->a[] = $input; } return $ret; }
public function result($result) { return $this->xf->result($result); }
public function step($result, $input) { return $this->xf->step($result, call_user_func($this->f, $input)); }