I hve no idea how this isn't in VCS. I checked hg and git. Is it in an old branch that I deleted before merging or something? I have backups from which to restore, but it would be nice to know how I effed it up in the first place, eh?
20 KiB
20 KiB
In [1]:
from notebook_preamble import J, V, defineIn [2]:
define('&& [nullary] cons [nullary [0]] dip branch')
define('|| [nullary] cons [nullary] dip [1] branch')In [3]:
define('!- 0 >=')In [4]:
define('spiral_next [[[abs] ii <=] [[<>] [pop !-] ||] &&] [[!-] [[++]] [[--]] ifte dip] [[pop !-] [--] [++] ifte] ifte')In [5]:
J('0 0 spiral_next')1 0
In [6]:
J('1 0 spiral_next')1 -1
In [7]:
J('1 -1 spiral_next')0 -1
In [8]:
J('0 -1 spiral_next')-1 -1
In [9]:
J('[0 0] [spiral_next] infra')[0 1]
In [10]:
J('[0 0] [dup [spiral_next] infra] make_generator x x x x pop')[0 0] [0 1] [-1 1] [-1 0]
In [11]:
define('_spn_P [[abs] ii <=] [[<>] [pop !-] ||] &&')
define('_spn_T [!-] [[++]] [[--]] ifte dip')
define('_spn_E [pop !-] [--] [++] ifte')
define('spiral_next _spn_P [_spn_E] [_spn_T] branch')In [12]:
V('23 18 spiral_next') . 23 18 spiral_next
23 . 18 spiral_next
23 18 . spiral_next
23 18 . _spn_P [_spn_E] [_spn_T] branch
23 18 . [[abs] ii <=] [[<>] [pop !-] ||] && [_spn_E] [_spn_T] branch
23 18 [[abs] ii <=] . [[<>] [pop !-] ||] && [_spn_E] [_spn_T] branch
23 18 [[abs] ii <=] [[<>] [pop !-] ||] . && [_spn_E] [_spn_T] branch
23 18 [[abs] ii <=] [[<>] [pop !-] ||] . [nullary] cons [nullary [0]] dip branch [_spn_E] [_spn_T] branch
23 18 [[abs] ii <=] [[<>] [pop !-] ||] [nullary] . cons [nullary [0]] dip branch [_spn_E] [_spn_T] branch
23 18 [[abs] ii <=] [[[<>] [pop !-] ||] nullary] . [nullary [0]] dip branch [_spn_E] [_spn_T] branch
23 18 [[abs] ii <=] [[[<>] [pop !-] ||] nullary] [nullary [0]] . dip branch [_spn_E] [_spn_T] branch
23 18 [[abs] ii <=] . nullary [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 [[abs] ii <=] . [stack] dinfrirst [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 [[abs] ii <=] [stack] . dinfrirst [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 [[abs] ii <=] [stack] . dip infra first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 . stack [[abs] ii <=] infra first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 [18 23] . [[abs] ii <=] infra first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 [18 23] [[abs] ii <=] . infra first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 . [abs] ii <= [18 23] swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 [abs] . ii <= [18 23] swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 [abs] . [dip] dupdip i <= [18 23] swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 [abs] [dip] . dupdip i <= [18 23] swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 [abs] . dip [abs] i <= [18 23] swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 . abs 18 [abs] i <= [18 23] swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 . 18 [abs] i <= [18 23] swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 . [abs] i <= [18 23] swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 [abs] . i <= [18 23] swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 . abs <= [18 23] swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 . <= [18 23] swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
False . [18 23] swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
False [18 23] . swaack first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 [False] . first [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 False . [0] [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 False [0] . [[[<>] [pop !-] ||] nullary] branch [_spn_E] [_spn_T] branch
23 18 False [0] [[[<>] [pop !-] ||] nullary] . branch [_spn_E] [_spn_T] branch
23 18 . 0 [_spn_E] [_spn_T] branch
23 18 0 . [_spn_E] [_spn_T] branch
23 18 0 [_spn_E] . [_spn_T] branch
23 18 0 [_spn_E] [_spn_T] . branch
23 18 . _spn_E
23 18 . [pop !-] [--] [++] ifte
23 18 [pop !-] . [--] [++] ifte
23 18 [pop !-] [--] . [++] ifte
23 18 [pop !-] [--] [++] . ifte
23 18 [pop !-] [--] [++] . [nullary not] dipd branch
23 18 [pop !-] [--] [++] [nullary not] . dipd branch
23 18 [pop !-] . nullary not [--] [++] branch
23 18 [pop !-] . [stack] dinfrirst not [--] [++] branch
23 18 [pop !-] [stack] . dinfrirst not [--] [++] branch
23 18 [pop !-] [stack] . dip infra first not [--] [++] branch
23 18 . stack [pop !-] infra first not [--] [++] branch
23 18 [18 23] . [pop !-] infra first not [--] [++] branch
23 18 [18 23] [pop !-] . infra first not [--] [++] branch
23 18 . pop !- [18 23] swaack first not [--] [++] branch
23 . !- [18 23] swaack first not [--] [++] branch
23 . 0 >= [18 23] swaack first not [--] [++] branch
23 0 . >= [18 23] swaack first not [--] [++] branch
True . [18 23] swaack first not [--] [++] branch
True [18 23] . swaack first not [--] [++] branch
23 18 [True] . first not [--] [++] branch
23 18 True . not [--] [++] branch
23 18 False . [--] [++] branch
23 18 False [--] . [++] branch
23 18 False [--] [++] . branch
23 18 . --
23 17 .