3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace igorw\reasoned { // microKanren implementation class Variable { public $name; function __construct($name) { $this->name = $name; } function is_equal(Variable $var) { return $this->name === $var->name; } } function variable($name) { return new Variable($name); } function is_variable($x) { return $x instanceof Variable; } class Substitution { public $values; function __construct(array $values = []) { $this->values = $values; } function walk($u) { if (is_variable($u) && null !== $value = $this->find($u)) { return $this->walk($value); } return $u; } function find(Variable $var) { foreach ($this->values as list($x, $value)) { if ($var->is_equal($x)) { return $value; } } return null; } function extend(Variable $x, $value) { return new Substitution(array_merge( [[$x, $value]], $this->values )); } function length() { return count($this->values); } function reify($v) { $v = $this->walk($v); if (is_variable($v)) { $n = reify_name($this->length()); return $this->extend($v, $n); } if (is_unifiable_array($v)) { return $this->reify(first($v)) ->reify(rest($v)); } return $this; } } class State { public $subst; public $count; function __construct(Substitution $subst = null, $count = 0) { $this->subst = $subst ?: new Substitution(); $this->count = $count; } function next() { return new State($this->subst, $this->count + 1); } function reify() { $v = walk_star(variable(0), $this->subst); return walk_star($v, (new Substitution())->reify($v)); } } function eq($u, $v) { return function (State $state) use ($u, $v) { $subst = unify($u, $v, $state->subst); if ($subst) { return unit(new State($subst, $state->count)); } return mzero(); }; } function unit(State $state) { return new PairStream($state, mzero()); } function mzero() { return new EmptyStream(); } function is_unifiable_array($value) { return is_pair($value) || is_array($value) && count($value) > 0; } class Pair { public $first; public $rest; function __construct($first, $rest) { $this->first = $first; $this->rest = $rest; } } function pair($first, $rest) { return new Pair($first, $rest); } function is_pair($x) { return $x instanceof Pair; } function unify($u, $v, Substitution $subst) { $u = $subst->walk($u); $v = $subst->walk($v); if (is_variable($u) && is_variable($v) && $u->is_equal($v)) { return $subst; } if (is_variable($u)) { return $subst->extend($u, $v); } if (is_variable($v)) { return $subst->extend($v, $u); } if (is_unifiable_array($u) && is_unifiable_array($v)) { $subst = unify(first($u), first($v), $subst); return $subst ? unify(rest($u), rest($v), $subst) : null; } if ($u === $v) { return $subst; } return null; } // $f takes a fresh variable and returns a goal function call_fresh(callable $f) { return function (State $state) use ($f) { $goal = $f(variable($state->count)); return $goal($state->next()); }; } // same as call_fresh, but without fresh var function delay(callable $f) { return function (State $state) use ($f) { $goal = $f(); return $goal($state->next()); }; } function disj(callable $goal1, callable $goal2) { return function (State $state) use ($goal1, $goal2) { return $goal1($state)->mplus($goal2($state)); }; } function conj(callable $goal1, callable $goal2) { return function (State $state) use ($goal1, $goal2) { return $goal1($state)->bind($goal2); }; } function cons($value, array $list) { array_unshift($list, $value); return $list; } function first($list) { if (is_pair($list)) { return $list->first; } return array_shift($list); } function rest($list) { if (is_pair($list)) { return $list->rest; } array_shift($list); return $list; } interface Stream extends \IteratorAggregate { function mplus(Stream $stream2); function bind(callable $goal); } class EmptyStream implements Stream { function mplus(Stream $stream2) { return $stream2; } function bind(callable $goal) { return mzero(); } function getIterator() { return new \EmptyIterator(); } } class CallableStream implements Stream { public $f; function __construct(callable $f) { $this->f = $f; } function mplus(Stream $stream2) { return new CallableStream(function () use ($stream2) { return $stream2->mplus($this->resolve()); }); } function bind(callable $goal) { return new CallableStream(function () use ($goal) { return $this->resolve()->bind($goal); }); } function getIterator() { return $this->resolve()->getIterator(); } function resolve() { return call_user_func($this->f); } } class PairStream implements Stream { public $first; public $rest; function __construct($first, Stream $rest) { $this->first = $first; $this->rest = $rest; } function mplus(Stream $stream2) { return new PairStream($this->first, $this->rest->mplus($stream2)); } function bind(callable $goal) { return $goal($this->first)->mplus($this->rest->bind($goal)); } function getIterator() { yield $this->first; foreach ($this->rest as $x) { yield $x; } } } // recovering miniKanren's control operators function zzz(callable $goal) { return function (State $state) use ($goal) { return new CallableStream(function () use ($goal, $state) { return $goal($state); }); }; } function conj_plus(array $goals) { if (count($goals) === 0) { throw new \InvalidArgumentException('Must supply at least one goal'); } if (count($goals) === 1) { return zzz(first($goals)); } return conj(zzz(first($goals)), conj_plus(rest($goals))); } function disj_plus(array $goals) { if (count($goals) === 0) { throw new \InvalidArgumentException('Must supply at least one goal'); } if (count($goals) === 1) { return zzz(first($goals)); } return disj(zzz(first($goals)), disj_plus(rest($goals))); } function conde(array $lines) { return disj_plus(array_map('igorw\reasoned\conj_plus', $lines)); } // based heavily on mudge/php-microkanren function fresh(callable $f) { $argCount = (new \ReflectionFunction($f))->getNumberOfParameters(); if ($argCount === 0) { return delay($f); } return call_fresh(function ($x) use ($f, $argCount) { return collect_args($f, $argCount, [$x]); }); } function collect_args(callable $f, $argCount, $args) { if (count($args) === $argCount) { return call_user_func_array($f, $args); } return call_fresh(function ($x) use ($f, $argCount, $args) { return collect_args($f, $argCount, array_merge($args, [$x])); }); } // from streams to lists // @todo use iter? function take($n, $stream) { foreach ($stream as $x) { if ($n-- === 0) { break; } yield $x; } } function map(callable $f, $stream) { foreach ($stream as $x) { yield $f($x); } } function to_array($stream) { $array = []; foreach ($stream as $x) { $array[] = $x; } return $array; } // recovering reification function reify($states) { return map(function (State $state) { return $state->reify(); }, $states); } function reify_name($n) { return "_.$n"; } function walk_star($v, Substitution $subst) { $v = $subst->walk($v); if (is_variable($v)) { return $v; } if (is_pair($v)) { $first = walk_star(first($v), $subst); $rest = walk_star(rest($v), $subst); if (is_array($rest)) { return cons($first, $rest); } return [$first, '.', $rest]; } if (is_unifiable_array($v)) { return cons(walk_star(first($v), $subst), walk_star(rest($v), $subst)); } return $v; } // recovering the scheme interface function call_goal(callable $goal) { return $goal(new State()); } function run($n, callable $goal) { return to_array(take($n, reify(call_goal(fresh($goal))))); } function run_star(callable $goal) { return to_array(reify(call_goal(fresh($goal)))); } function all(array $goals) { return conj_plus($goals); } // unicode madness function ≡($u, $v) { return eq($u, $v); } function ⋀(array $goals) { return conj_plus($goals); } function ⋁(array $goals) { return disj_plus($goals); } function run٭(callable $goal) { return run_star($goal); } function condᵉ(array $lines) { return conde($lines); } // user level plumbing function conso($a, $d, $l) { return eq(pair($a, $d), $l); } function firsto($l, $a) { return fresh(function ($d) use ($l, $a) { return conso($a, $d, $l); }); } function resto($l, $d) { return fresh(function ($a) use ($l, $d) { return conso($a, $d, $l); }); } function appendo($l, $s, $out) { return conde([ [eq($l, []), eq($s, $out)], [fresh(function ($a, $d, $res) use ($l, $s, $out) { return all([ conso($a, $d, $l), conso($a, $res, $out), appendo($d, $s, $res), ]); })], ]); } // user level unicode madness function consᵒ($a, $d, $l) { return conso($a, $d, $l); } function firstᵒ($l, $a) { return firsto($l, $a); } function restᵒ($l, $d) { return resto($l, $d); } function appendᵒ($l, $s, $out) { return appendo($l, $s, $out); } // debugging goals (inspired by core.logic) function log($msg) { return function (State $state) use ($msg) { echo "$msg\n"; return unit($state); }; } function trace_subst() { return function (State $state) { var_dump($state->subst); return unit($state); }; } function trace_lvars(array $vars) { return function (State $state) use ($vars) { foreach ($vars as $var) { $v = walk_star($var, $state->subst); $reified = walk_star($v, (new Substitution())->reify($v)); if (is_variable($var) && is_string($reified)) { echo "variable({$var->name}) = $reified\n"; } else if (is_variable($var)) { echo "variable({$var->name}) =\n"; var_dump($reified); } else { var_dump($reified); } } return unit($state); }; } } namespace { use igor\reasoned as i; i\run(function ($q) { return i\eq($q, 'Hello'); }); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  193     0  E >   DECLARE_CLASS                                            'igorw%5Creasoned%5Cstream'
  198     1        DECLARE_CLASS                                            'igorw%5Creasoned%5Cemptystream'
  210     2        DECLARE_CLASS                                            'igorw%5Creasoned%5Ccallablestream'
  233     3        DECLARE_CLASS                                            'igorw%5Creasoned%5Cpairstream'
  492     4        INIT_FCALL_BY_NAME                                       'igor%5Creasoned%5Crun'
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FkDIqm%3A492%2416'
  494     6        SEND_VAL_EX                                              ~0
          7        DO_FCALL                                      0          
  495     8      > RETURN                                                   1

Function igorw%5Creasoned%5Cvariable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\variable
number of ops:  6
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        NEW                                              $1      'igorw%5Creasoned%5CVariable'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4      > RETURN                                                   $1
   19     5*     > RETURN                                                   null

End of function igorw%5Creasoned%5Cvariable

Function igorw%5Creasoned%5Cis_variable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\is_variable
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        INSTANCEOF                                       ~1      !0, 'igorw%5Creasoned%5CVariable'
          2      > RETURN                                                   ~1
   23     3*     > RETURN                                                   null

End of function igorw%5Creasoned%5Cis_variable

Function igorw%5Creasoned%5Ceq:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\eq
number of ops:  7
compiled vars:  !0 = $u, !1 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   83     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   84     2        DECLARE_LAMBDA_FUNCTION                                  '%00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A84%240'
          3        BIND_LEXICAL                                             ~2, !0
          4        BIND_LEXICAL                                             ~2, !1
   90     5      > RETURN                                                   ~2
   91     6*     > RETURN                                                   null

End of function igorw%5Creasoned%5Ceq

Function %00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A84%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 22
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\{closure}
number of ops:  26
compiled vars:  !0 = $state, !1 = $u, !2 = $v, !3 = $subst
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   84     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   85     3        INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cunify'
          4        SEND_VAR_EX                                              !1
          5        SEND_VAR_EX                                              !2
          6        CHECK_FUNC_ARG                                           
          7        FETCH_OBJ_FUNC_ARG                               $4      !0, 'subst'
          8        SEND_FUNC_ARG                                            $4
          9        DO_FCALL                                      0  $5      
         10        ASSIGN                                                   !3, $5
   86    11      > JMPZ                                                     !3, ->22
   87    12    >   INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cunit'
         13        NEW                                              $7      'igorw%5Creasoned%5CState'
         14        SEND_VAR_EX                                              !3
         15        CHECK_FUNC_ARG                                           
         16        FETCH_OBJ_FUNC_ARG                               $8      !0, 'count'
         17        SEND_FUNC_ARG                                            $8
         18        DO_FCALL                                      0          
         19        SEND_VAR_NO_REF_EX                                       $7
         20        DO_FCALL                                      0  $10     
         21      > RETURN                                                   $10
   89    22    >   INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cmzero'
         23        DO_FCALL                                      0  $11     
         24      > RETURN                                                   $11
   90    25*     > RETURN                                                   null

End of function %00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A84%240

Function igorw%5Creasoned%5Cunit:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\unit
number of ops:  9
compiled vars:  !0 = $state
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   93     0  E >   RECV                                             !0      
   94     1        NEW                                              $1      'igorw%5Creasoned%5CPairStream'
          2        SEND_VAR_EX                                              !0
          3        INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cmzero'
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR_NO_REF_EX                                       $2
          6        DO_FCALL                                      0          
          7      > RETURN                                                   $1
   95     8*     > RETURN                                                   null

End of function igorw%5Creasoned%5Cunit

Function igorw%5Creasoned%5Cmzero:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\mzero
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   98     0  E >   NEW                                              $0      'igorw%5Creasoned%5CEmptyStream'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
   99     3*     > RETURN                                                   null

End of function igorw%5Creasoned%5Cmzero

Function igorw%5Creasoned%5Cis_unifiable_array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 15
filename:       /in/kDIqm
function name:  igorw\reasoned\is_unifiable_array
number of ops:  17
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  101     0  E >   RECV                                             !0      
  102     1        INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cis_pair'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > JMPNZ_EX                                         ~2      $1, ->15
          5    >   INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cis_array'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $3      
          8      > JMPZ_EX                                          ~4      $3, ->14
          9    >   INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Ccount'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0  $5      
         12        IS_SMALLER                                       ~6      0, $5
         13        BOOL                                             ~4      ~6
         14    >   BOOL                                             ~2      ~4
         15    > > RETURN                                                   ~2
  103    16*     > RETURN                                                   null

End of function igorw%5Creasoned%5Cis_unifiable_array

Function igorw%5Creasoned%5Cpair:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\pair
number of ops:  8
compiled vars:  !0 = $first, !1 = $rest
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  114     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  115     2        NEW                                              $2      'igorw%5Creasoned%5CPair'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
          6      > RETURN                                                   $2
  116     7*     > RETURN                                                   null

End of function igorw%5Creasoned%5Cpair

Function igorw%5Creasoned%5Cis_pair:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\is_pair
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  118     0  E >   RECV                                             !0      
  119     1        INSTANCEOF                                       ~1      !0, 'igorw%5Creasoned%5CPair'
          2      > RETURN                                                   ~1
  120     3*     > RETURN                                                   null

End of function igorw%5Creasoned%5Cis_pair

Function igorw%5Creasoned%5Cunify:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 35
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 44
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
2 jumps found. (Code = 46) Position 1 = 48, Position 2 = 52
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 81
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 79
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 81
2 jumps found. (Code = 43) Position 1 = 83, Position 2 = 84
Branch analysis from position: 83
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 84
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
Branch analysis from position: 24
Branch analysis from position: 19
filename:       /in/kDIqm
function name:  igorw\reasoned\unify
number of ops:  86
compiled vars:  !0 = $u, !1 = $v, !2 = $subst
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  122     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
  123     3        INIT_METHOD_CALL                                         !2, 'walk'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !0, $3
  124     7        INIT_METHOD_CALL                                         !2, 'walk'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $5      
         10        ASSIGN                                                   !1, $5
  126    11        INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cis_variable'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0  $7      
         14      > JMPZ_EX                                          ~8      $7, ->19
         15    >   INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cis_variable'
         16        SEND_VAR_EX                                              !1
         17        DO_FCALL                                      0  $9      
         18        BOOL                                             ~8      $9
         19    > > JMPZ_EX                                          ~8      ~8, ->24
         20    >   INIT_METHOD_CALL                                         !0, 'is_equal'
         21        SEND_VAR_EX                                              !1
         22        DO_FCALL                                      0  $10     
         23        BOOL                                             ~8      $10
         24    > > JMPZ                                                     ~8, ->26
  127    25    > > RETURN                                                   !2
  129    26    >   INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cis_variable'
         27        SEND_VAR_EX                                              !0
         28        DO_FCALL                                      0  $11     
         29      > JMPZ                                                     $11, ->35
  130    30    >   INIT_METHOD_CALL                                         !2, 'extend'
         31        SEND_VAR_EX                                              !0
         32        SEND_VAR_EX                                              !1
         33        DO_FCALL                                      0  $12     
         34      > RETURN                                                   $12
  132    35    >   INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cis_variable'
         36        SEND_VAR_EX                                              !1
         37        DO_FCALL                                      0  $13     
         38      > JMPZ                                                     $13, ->44
  133    39    >   INIT_METHOD_CALL                                         !2, 'extend'
         40        SEND_VAR_EX                                              !1
         41        SEND_VAR_EX                                              !0
         42        DO_FCALL                                      0  $14     
         43      > RETURN                                                   $14
  135    44    >   INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cis_unifiable_array'
         45        SEND_VAR_EX                                              !0
         46        DO_FCALL                                      0  $15     
         47      > JMPZ_EX                                          ~16     $15, ->52
         48    >   INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cis_unifiable_array'
         49        SEND_VAR_EX                                              !1
         50        DO_FCALL                                      0  $17     
         51        BOOL                                             ~16     $17
         52    > > JMPZ                                                     ~16, ->81
  136    53    >   INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cunify'
         54        INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cfirst'
         55        SEND_VAR_EX                                              !0
         56        DO_FCALL                                      0  $18     
         57        SEND_VAR_NO_REF_EX                                       $18
         58        INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cfirst'
         59        SEND_VAR_EX                                              !1
         60        DO_FCALL                                      0  $19     
         61        SEND_VAR_NO_REF_EX                                       $19
         62        SEND_VAR_EX                                              !2
         63        DO_FCALL                                      0  $20     
         64        ASSIGN                                                   !2, $20
  137    65      > JMPZ                                                     !2, ->79
         66    >   INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cunify'
         67        INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Crest'
         68        SEND_VAR_EX                                              !0
         69        DO_FCALL                                      0  $22     
         70        SEND_VAR_NO_REF_EX                                       $22
         71        INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Crest'
         72        SEND_VAR_EX                                              !1
         73        DO_FCALL                                      0  $23     
         74        SEND_VAR_NO_REF_EX                                       $23
         75        SEND_VAR_EX                                              !2
         76        DO_FCALL                                      0  $24     
         77        QM_ASSIGN                                        ~25     $24
         78      > JMP                                                      ->80
         79    >   QM_ASSIGN                                        ~25     null
         80    > > RETURN                                                   ~25
  139    81    >   IS_IDENTICAL                                             !0, !1
         82      > JMPZ                                                     ~26, ->84
  140    83    > > RETURN                                                   !2
  142    84    > > RETURN                                                   null
  143    85*     > RETURN                                                   null

End of function igorw%5Creasoned%5Cunify

Function igorw%5Creasoned%5Ccall_fresh:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\call_fresh
number of ops:  5
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  146     0  E >   RECV                                             !0      
  147     1        DECLARE_LAMBDA_FUNCTION                                  '%00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A147%241'
          2        BIND_LEXICAL                                             ~1, !0
  150     3      > RETURN                                                   ~1
  151     4*     > RETURN                                                   null

End of function igorw%5Creasoned%5Ccall_fresh

Function %00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A147%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\{closure}
number of ops:  18
compiled vars:  !0 = $state, !1 = $f, !2 = $goal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  147     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
  148     2        INIT_DYNAMIC_CALL                                        !1
          3        INIT_NS_FCALL_BY_NAME                                    'igorw%5Creasoned%5Cvariable'
          4        CHECK_FUNC_ARG                                           
          5        FETCH_OBJ_FUNC_ARG                               $3      !0, 'count'
          6        SEND_FUNC_ARG                                            $3
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR_NO_REF_EX                                       $4
          9        DO_FCALL                                      0  $5      
         10        ASSIGN                                                   !2, $5
  149    11        INIT_DYNAMIC_CALL                                        !2
         12        INIT_METHOD_CALL                                         !0, 'next'
         13        DO_FCALL                                      0  $7      
         14        SEND_VAR_NO_REF_EX                                       $7
         15        DO_FCALL                                      0  $8      
         16      > RETURN                                                   $8
  150    17*     > RETURN                                                   null

End of function %00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A147%241

Function igorw%5Creasoned%5Cdelay:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\delay
number of ops:  5
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  154     0  E >   RECV                                             !0      
  155     1        DECLARE_LAMBDA_FUNCTION                                  '%00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A155%242'
          2        BIND_LEXICAL                                             ~1, !0
  158     3      > RETURN                                                   ~1
  159     4*     > RETURN                                                   null

End of function igorw%5Creasoned%5Cdelay

Function %00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A155%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\{closure}
number of ops:  12
compiled vars:  !0 = $state, !1 = $f, !2 = $goal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  155     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
  156     2        INIT_DYNAMIC_CALL                                        !1
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !2, $3
  157     5        INIT_DYNAMIC_CALL                                        !2
          6        INIT_METHOD_CALL                                         !0, 'next'
          7        DO_FCALL                                      0  $5      
          8        SEND_VAR_NO_REF_EX                                       $5
          9        DO_FCALL                                      0  $6      
         10      > RETURN                                                   $6
  158    11*     > RETURN                                                   null

End of function %00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A155%242

Function igorw%5Creasoned%5Cdisj:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\disj
number of ops:  7
compiled vars:  !0 = $goal1, !1 = $goal2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  161     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  162     2        DECLARE_LAMBDA_FUNCTION                                  '%00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A162%243'
          3        BIND_LEXICAL                                             ~2, !0
          4        BIND_LEXICAL                                             ~2, !1
  164     5      > RETURN                                                   ~2
  165     6*     > RETURN                                                   null

End of function igorw%5Creasoned%5Cdisj

Function %00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A162%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\{closure}
number of ops:  14
compiled vars:  !0 = $state, !1 = $goal1, !2 = $goal2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  162     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
  163     3        INIT_DYNAMIC_CALL                                        !1
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $3      
          6        INIT_METHOD_CALL                                         $3, 'mplus'
          7        INIT_DYNAMIC_CALL                                        !2
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $4      
         10        SEND_VAR_NO_REF_EX                                       $4
         11        DO_FCALL                                      0  $5      
         12      > RETURN                                                   $5
  164    13*     > RETURN                                                   null

End of function %00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A162%243

Function igorw%5Creasoned%5Cconj:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\conj
number of ops:  7
compiled vars:  !0 = $goal1, !1 = $goal2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  167     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  168     2        DECLARE_LAMBDA_FUNCTION                                  '%00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A168%244'
          3        BIND_LEXICAL                                             ~2, !0
          4        BIND_LEXICAL                                             ~2, !1
  170     5      > RETURN                                                   ~2
  171     6*     > RETURN                                                   null

End of function igorw%5Creasoned%5Cconj

Function %00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A168%244:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kDIqm
function name:  igorw\reasoned\{closure}
number of ops:  11
compiled vars:  !0 = $state, !1 = $goal1, !2 = $goal2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  168     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
  169     3        INIT_DYNAMIC_CALL                                        !1
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $3      
          6        INIT_METHOD_CALL                                         $3, 'bind'
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0  $4      
          9      > RETURN                                                   $4
  170    10*     > RETURN                                                   null

End of function %00igorw%5Creasoned%5C%7Bclosure%7D%2Fin%2FkDIqm%3A168%244

Function igorw%5Creasoned%5Ccons:
Find

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.94 ms | 1431 KiB | 35 Q