OSDN Git Service

Shortcircuit Boolean combinators.
authorSimon Forman <sforman@hushmail.com>
Thu, 23 Apr 2020 22:15:36 +0000 (15:15 -0700)
committerSimon Forman <sforman@hushmail.com>
Thu, 23 Apr 2020 22:15:36 +0000 (15:15 -0700)
thun/defs.txt

index bd77d1e..043b96a 100644 (file)
@@ -1,6 +1,10 @@
 -- 1 -\r
 ? dup bool\r
+&& [nullary] cons [nullary [false]] dip branch\r
 ++ 1 +\r
+|| [nullary] cons [nullary] dip [true] branch\r
+!- 0 >=\r
+abs dup 0 < [] [neg] branch\r
 anamorphism [pop []] swap [dip swons] genrec\r
 app1 grba infrst\r
 app2 [grba swap grba swap] dip [infrst] cons ii\r
@@ -57,6 +61,7 @@ second rest first
 shift uncons [swons] dip\r
 shunt [swons] step\r
 size 0 swap [pop ++] step\r
+spiral_next [[[abs] ii <=] [[<>] [pop !-] ||] &&] [[!-] [[++]] [[--]] ifte dip] [[pop !-] [--] [++] ifte] ifte\r
 split_at [drop] [take] clop\r
 sqr dup *\r
 step_zero 0 roll> step\r