From 53632fdbadca9234027155f30c9e15be124699c7 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Thu, 23 Apr 2020 15:15:36 -0700 Subject: [PATCH] Shortcircuit Boolean combinators. --- thun/defs.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/thun/defs.txt b/thun/defs.txt index bd77d1e..043b96a 100644 --- a/thun/defs.txt +++ b/thun/defs.txt @@ -1,6 +1,10 @@ -- 1 - ? dup bool +&& [nullary] cons [nullary [false]] dip branch ++ 1 + +|| [nullary] cons [nullary] dip [true] branch +!- 0 >= +abs dup 0 < [] [neg] branch anamorphism [pop []] swap [dip swons] genrec app1 grba infrst app2 [grba swap grba swap] dip [infrst] cons ii @@ -57,6 +61,7 @@ second rest first shift uncons [swons] dip shunt [swons] step size 0 swap [pop ++] step +spiral_next [[[abs] ii <=] [[<>] [pop !-] ||] &&] [[!-] [[++]] [[--]] ifte dip] [[pop !-] [--] [++] ifte] ifte split_at [drop] [take] clop sqr dup * step_zero 0 roll> step