Move all the bigints code into own dir.

This commit is contained in:
Simon Forman
2023-02-14 08:48:08 -08:00
parent e771e0182b
commit ae77bbda24
6 changed files with 0 additions and 0 deletions
+296
View File
@@ -0,0 +1,296 @@
<-top
joy?
<-top
joy?
[base 2147483648] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] [cons-but-not-leading-zeroes [[bool] ii | not] [popd] [cons] ifte] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] [cons-but-not-leading-zeroes [[bool] ii | not] [popd] [cons] ifte] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] [cons-but-not-leading-zeroes [[bool] ii | not] [popd] [cons] ifte] [sub-with-carry _sub-with-carry0 _sub-with-carry1] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] [cons-but-not-leading-zeroes [[bool] ii | not] [popd] [cons] ifte] [sub-with-carry _sub-with-carry0 _sub-with-carry1] [_sub-with-carry0 rolldown bool-to-int [-] ii] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] [cons-but-not-leading-zeroes [[bool] ii | not] [popd] [cons] ifte] [sub-with-carry _sub-with-carry0 _sub-with-carry1] [_sub-with-carry0 rolldown bool-to-int [-] ii] [_sub-with-carry1 [base + base mod] [0 <] cleave] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] [cons-but-not-leading-zeroes [[bool] ii | not] [popd] [cons] ifte] [sub-with-carry _sub-with-carry0 _sub-with-carry1] [_sub-with-carry0 rolldown bool-to-int [-] ii] [_sub-with-carry1 [base + base mod] [0 <] cleave] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] [cons-but-not-leading-zeroes [[bool] ii | not] [popd] [cons] ifte] [sub-with-carry _sub-with-carry0 _sub-with-carry1] [_sub-with-carry0 rolldown bool-to-int [-] ii] [_sub-with-carry1 [base + base mod] [0 <] cleave] [sub-like-bigints [uncons] dip rest check-gt sub-digits cons] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] [cons-but-not-leading-zeroes [[bool] ii | not] [popd] [cons] ifte] [sub-with-carry _sub-with-carry0 _sub-with-carry1] [_sub-with-carry0 rolldown bool-to-int [-] ii] [_sub-with-carry1 [base + base mod] [0 <] cleave] [sub-like-bigints [uncons] dip rest check-gt sub-digits cons] [sub-digits initial-carry sub-digits'] <-top
joy?
[base 2147483648] [ditch-empty-list [bool] [popd] [pop] ifte] [bool-to-int [0] [1] branch] [uncons-two [uncons] ii swapd] [sandwich swap [cons] dip swoncat] [digitalize [0 <=] [pop []] [base divmod swap] [i cons] genrec] [to-bigint [!-] [abs digitalize] cleave cons] [prep rest 1 0 rolldown] [from-bigint' [next-digit] step popd] [next-digit [increase-power] [accumulate-digit] clop popdd] [increase-power popop base *] [accumulate-digit rolldown * +] [sign-int [first] [prep from-bigint'] cleave] [neg-if-necessary swap [neg] [] branch] [from-bigint sign-int neg-if-necessary] [add-with-carry _add-with-carry0 _add-with-carry1] [_add-with-carry0 [bool-to-int] dipd + +] [_add-with-carry1 base [mod] [>=] clop] [add-carry-to-digits [pop not] [popd] [_actd_R0] [i cons] genrec] [_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte] [_actd_R0.else popd 1 false rolldown] [_actd_R0.then 0 swap uncons [add-with-carry] dip] [add-digits initial-carry add-digits'] [initial-carry false rollup] [add-digits' [P] [THEN] [R0] [R1] genrec] [P [bool] ii & not] [THEN [P'] [THEN'] [ELSE] ifte] [R0 uncons-two [add-with-carry] dipd] [R1 i cons] [P' [bool] ii |] [THEN' ditch-empty-list add-carry-to-digits] [ELSE pop swap [] [1 swons] branch] [same-sign [first] ii xor not] [add-like-bigints [uncons] dip rest add-digits cons] [add-bigints [same-sign] [add-like-bigints] [1 0 /] ifte] [build-two-list-combiner _btlc0 _btlc1 [i cons]] [_btlc0.0 [[ditch-empty-list] swoncat] dip] [_btlc0.1 [pop] swoncat] [_btlc0.3 [_btlc0.0 _btlc0.1] dip] [_btlc0.4 [uncons-two] [dipd] sandwich] [_btlc0 _btlc0.3 _btlc0.4] [_btlc1 [[ifte] ccons [P'] swons [P] swap] dip] [carry [] [1 swons] branch] [compare-pairs [bool not] [pop false] [[first [>=] infrst] [pop true]] [[rest] swoncat ifte] genrec] [xR1 uncons-two [unit cons swons] dipd] [xP [bool] ii & not] [BASE [bool] [popop pop true] [[pop bool] [popop pop false] [popop compare-pairs] ifte] ifte] [gt-bigint <<{} [xP] [BASE] [xR1] tailrec] [check-gt [gt-bigint] [swap [not] dipd] [] ifte] [sub-carry pop] [cons-but-not-leading-zeroes [[bool] ii | not] [popd] [cons] ifte] [sub-with-carry _sub-with-carry0 _sub-with-carry1] [_sub-with-carry0 rolldown bool-to-int [-] ii] [_sub-with-carry1 [base + base mod] [0 <] cleave] [sub-like-bigints [uncons] dip rest check-gt sub-digits cons] [sub-digits initial-carry sub-digits'] <-top
joy?
<-top
joy?
<-top
joy?
[add-carry-to-digits] <-top
joy?
[add-carry-to-digits] [swap carry] <-top
joy?
[add-carry-to-digits] [swap carry] [add-with-carry] <-top
joy?
[P] [[P'] [ditch-empty-list add-carry-to-digits] [pop swap carry] ifte] [uncons-two [add-with-carry] dipd] [i cons] <-top
joy?
[[P] [[P'] [ditch-empty-list add-carry-to-digits] [pop swap carry] ifte] [uncons-two [add-with-carry] dipd] [i cons] genrec] <-top
joy?
[add-digits' [P] [[P'] [ditch-empty-list add-carry-to-digits] [pop swap carry] ifte] [uncons-two [add-with-carry] dipd] [i cons] genrec] <-top
joy?
<-top
joy?
<-top
joy?
[sub-carry-from-digits] <-top
joy?
[sub-carry-from-digits] [swap sub-carry] <-top
joy?
[sub-carry-from-digits] [swap sub-carry] [sub-with-carry] <-top
joy?
[P] [[P'] [ditch-empty-list sub-carry-from-digits] [pop swap sub-carry] ifte] [uncons-two [sub-with-carry] dipd] [i cons] <-top
joy?
[[P] [[P'] [ditch-empty-list sub-carry-from-digits] [pop swap sub-carry] ifte] [uncons-two [sub-with-carry] dipd] [i cons] genrec] <-top
joy?
[sub-digits' [P] [[P'] [ditch-empty-list sub-carry-from-digits] [pop swap sub-carry] ifte] [uncons-two [sub-with-carry] dipd] [i cons] genrec] <-top
joy?
<-top
joy?
<-top
joy?
<-top
joy?
[2147483647] <-top
joy?
[2147483647] <-top
joy?
[2147483647] <-top
joy?
[2147483647] •
+473
View File
@@ -0,0 +1,473 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2022 Simon Forman
#
# This file is part of Thun
#
# Thun is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thun is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Thun. If not see <http://www.gnu.org/licenses/>.
#
from copy import copy
from random import randint
from itertools import zip_longest
from pprint import pprint as P
import unittest
class BigInt:
def __init__(self, initial=0):
# We store a sign bit (True == non-negative)
# and a list of OberonInt, least significant digit
# to most.
self.sign = initial >= 0
if not self.sign:
initial = -initial
self.digits = list(self.digitize(initial)) # List of OberonInt.
def __repr__(self):
return f'BigInt({self.to_int()})'
@staticmethod
def digitize(n):
if n < 0:
raise ValueError(f'Non-negative only: {n}')
while n:
n, digit = divmod(n, 2**31)
yield OberonInt(digit)
def __str__(self):
return str(self.to_int())
def to_int(self):
power = 1
n = 0
for digit in self.digits:
n += digit.value * power
power <<= 31
if not self.sign:
n = -n
return n
def negate(self):
result = BigInt()
result.sign = not self.sign
result.digits = [
OberonInt(digit.value ^ 2**31 - 1)
for digit in self.digits
]
return result
def __add__(self, other):
if not isinstance(other, BigInt):
other = BigInt(other)
if self.sign == other.sign:
return self.add_like_signs(other)
return self.add_unlike_signs(other)
def __sub__(self, other):
if not isinstance(other, BigInt):
z = BigInt(other)
else:
z = copy(other)
z.sign = not z.sign
return self + z
def __mul__(self, other):
if not isinstance(other, BigInt):
other = BigInt(other)
if len(self.digits) < len(other.digits):
return other.__mul__(self)
acc = BigInt()
for i, digit in enumerate(other.digits):
acc = acc + self._mul_one_digit(i, digit)
acc.sign = not (self.sign ^ other.sign)
return acc
def _mul_one_digit(self, power, n):
# Some of this should go in a method of OberonInt?
digits = [zero] * power
carry = zero
for digit in self.digits:
high, low = digit * n
c, p = low + carry
digits.append(p)
carry = high
if c:
z, carry = carry + one
assert not z, repr(z)
if carry.value:
assert carry.value > 0
digits.append(carry)
result = BigInt()
result.digits = digits
return result
def add_like_signs(self, other):
'''
Add a BigInt of the same sign as self.
'''
assert self.sign == other.sign
out = []
carry = 0
Z = zip_longest(
self.digits,
other.digits,
fillvalue=zero, # Elegant, but not efficient?
)
for a, b in Z:
carry, digit = a.add_with_carry(b, carry)
out.append(digit)
if carry:
out.append(one)
result = BigInt()
result.sign = self.sign
result.digits = out
return result
def add_unlike_signs(self, other):
'''
Add a BigInt of unlike sign as self.
'''
assert self.sign != other.sign
# So we have -a and +b
# or +a and -b
a, b = (self, other) if self.sign else (other, self)
# So now we have:
# a + (-b) == a - b
# I don't know how to subtract a larger (abs) number
# from a smaller (abs) one
# However:
#
# a - b == -(b - a)
#
# I.e. 9 - 17 == -(17 - 9)
return a._subtract_smaller(b) if a.abs_gt_abs(b) else b._subtract_smaller(a)
def _subtract_smaller(self, other):
out = []
carry = 0
Z = zip_longest(
self.digits,
other.digits,
fillvalue=zero,
)
for a, b in Z:
carry, digit = a.sub_with_carry(b, carry)
out.append(digit)
assert not carry # a >= b, eh?
result = BigInt()
result.sign = self.sign
result.digits = out
return result
def abs_gt_abs(self, other):
a_len, b_len = len(self.digits), len(other.digits)
if a_len > b_len: return True
if a_len < b_len: return False
# a_len == b_len
if not a_len: # a == b == 0
return False
return self.digits[-1] > other.digits[-1]
def __eq__(self, other):
return self.sign == other.sign and self.digits == other.digits
def is_i32(n):
return -2**31 <= n < 2**31
class OberonInt:
'''
Let's model the Oberon RISC integers,
32-bit, two's complement.
'''
def __init__(self, initial=0):
assert is_i32(initial)
self.value = initial
def add_with_carry(self, other, carry):
'''
In terms of single base-10 skool arithmetic:
a, b in {0..9}
carry in {0..1}
9 + 9 + 1 = 18 + 1 = 19
aka = 1,(8+1) = 1, 9
'''
c, digit = self + other
if carry:
z, digit = digit + one
assert not z, repr(z)
return c, digit
def sub_with_carry(self, other, carry):
c, digit = self - other
if carry:
z, digit = digit - one
assert not z, repr(z)
return c, digit
def __add__(self, other):
'''
Return carry bit and new value.
'''
if not isinstance(other, OberonInt):
other = OberonInt(other)
n = self.value + other.value
carry = not is_i32(n)
if carry:
n &= 2**31 - 1
return carry, OberonInt(n)
__radd__ = __add__
def negate(self):
# Instead of binary ops, just cheat:
return OberonInt(
0 # Handle negation of obmin.
if self.value == -(2**31)
else -self.value
)
def __sub__(self, other):
if not isinstance(other, OberonInt):
other = OberonInt(other)
return self + other.negate()
__rsub__ = __sub__
def __repr__(self):
return f'OberonInt({self.value})'
def __eq__(self, other):
assert isinstance(other, OberonInt)
return self.value == other.value
def __gt__(self, other):
assert isinstance(other, OberonInt)
return self.value > other.value
def __mul__(self, other):
assert isinstance(other, OberonInt)
product = self.value * other.value
high = OberonInt(product >> 31)
low = OberonInt(product & (2**31 - 1))
return high, low
## # I think we want to put the 32nd bit of product
## # into the first bit of H, left-shifting H by one first.
## c = (H << 1) & (product >> 31) # What about H[32]?
## product &= 0x7fffffff # Zero out that 32nd bit.
##
## if carry:
## digit += one
## >>> n = obmax.value
## >>> n*n
## 4611686014132420609
## >>> bin(n*n)
## '0b11111111111111111111111111111100000000000000000000000000000001'
## >>> bin(n)
## '0b1111111111111111111111111111111'
## >>> bin(0b1111111111111111111111111111111 * 0b1111111111111111111111111111111)
## '0b11111111111111111111111111111100000000000000000000000000000001'
## >>> '0b00_111111 11111111 11111111 11111111|00000000 00000000 00000000 00000001'
# So we can see that multiplying obmax by itself leave two empty bits in the top half
# If we perform the above c = (H << 1) & (product >> 31) we get:
# c = 0b0_1111111 11111111 11111111 11111110
# p = 0b_00000000 00000000 00000000 00000001'
obmin, zero, one, obmax = map(OberonInt, (
-(2**31),
0,
1,
2**31-1,
))
class OberonIntTest(unittest.TestCase):
def test_Addition(self):
carry, z = obmax + one
self.assertTrue(carry)
self.assertEqual(z, zero)
def test_Negation(self):
negative_one = one.negate()
carry, m = obmin + negative_one
self.assertTrue(carry)
self.assertEqual(m, obmax)
def test_Subtraction(self):
# Ergo, subtraction.
carry, m = obmin - one
self.assertTrue(carry)
self.assertEqual(m, obmax)
def test_twice_max(self):
carry, hmm = obmax + obmax
self.assertTrue(carry)
self.assertEqual(hmm.value, 2**31 - 2)
carry, eh = obmax - hmm
self.assertFalse(carry)
self.assertEqual(eh, one)
self.assertEqual( (hmm + one)[1] , obmax )
def test_twice_min(self):
carry, n = obmin + obmin
self.assertTrue(carry)
self.assertEqual(n, zero)
def test_mul(self):
h, l = obmax * obmax
B = BigInt(obmax.value * obmax.value)
self.assertEqual([l, h], B.digits)
N = 100
rand = lambda: randint(0, 10**N) - (10**N)//2
# For some reason randint(-(10**100), 10**100) wasn't returning negative numbers.
# Above my pay grade. I don't even know if that's a bug,
# there are a /lot/ of numbers up around ten-to-the-hundreth-power, eh?
class BigIntTest(unittest.TestCase):
def test_to_int(self):
n = 12345678901234567898090123445678990
x = BigInt(n).to_int()
self.assertEqual(n, x)
def test_2_to_100th_power(self):
digits = list(BigInt.digitize(2**100))
self.assertEqual(
digits,
[OberonInt(0), OberonInt(0), OberonInt(0), OberonInt(128)],
)
def test_Addition(self):
n = 12345678901234567898090123445678990
m = 901234567898090
self._test_add(n, m)
def test_Addition_of_two_negatives(self):
n = -12345678901234567898090123445678990
m = -901234567898090
self._test_add(n, m)
def test_Addition_of_unlike_signs(self):
n = 12345678901234567898090123445678990
m = -901234567898090
self._test_add(n, m)
def _test_invert(self):
n = 7 * (2**16)
x = BigInt(n)
y = x.negate()
print()
print(y.to_int(), bin(y.to_int()), y.digits)
print(x.to_int(), bin(x.to_int()), x.digits)
print()
print(x + y)
def test_Subtraction_small_from_large(self):
n = 12345678901234567898090123445678990
m = 901234567898090
self._test_sub(n, m)
def test_Subtraction_large_from_small(self):
n = 901234567898090
m = 12345678901234567898090123445678990
self._test_sub(n, m)
def test_Subtraction_neg_small_from_large(self):
n = 12345678901234567898090123445678990
m = -901234567898090
self._test_sub(n, m)
def test_Subtraction_neg_large_from_small(self):
n = 901234567898090
m = -12345678901234567898090123445678990
self._test_sub(n, m)
def test_Subtraction_small_from_neg_large(self):
n = -12345678901234567898090123445678990
m = 901234567898090
self._test_sub(n, m)
def test_Subtraction_large_from_neg_small(self):
n = -901234567898090
m = 12345678901234567898090123445678990
self._test_sub(n, m)
def test_Subtraction_neg_small_from_neg_large(self):
n = -12345678901234567898090123445678990
m = -901234567898090
self._test_sub(n, m)
def test_Subtraction_neg_large_from_neg_small(self):
n = -901234567898090
m = -12345678901234567898090123445678990
self._test_sub(n, m)
def _test_add(self, n, m):
x = BigInt(n)
y = BigInt(m)
z = x + y
t = z.to_int()
self.assertEqual(t, n + m, f'{x} + {y}')
def _test_sub(self, n, m):
x = BigInt(n)
y = BigInt(m)
z = x - y
t = z.to_int()
self.assertEqual(t, n - m, f'{x} - {y}')
def _test_mul(self, n, m):
x = BigInt(n)
y = BigInt(m)
z = x * y
t = z.to_int()
self.assertEqual(t, n * m, f'{x} * {y}')
def test_mul(self):
a = 2063400293
b = -1483898257
self._test_mul(a, b)
def test_random_add_sub(self):
for _ in range(100):
a = rand()
b = rand()
#print(a, b)
self._test_add(a, b)
self._test_sub(a, b)
self._test_mul(a, b)
if __name__ == '__main__':
unittest.main()
+95
View File
@@ -0,0 +1,95 @@
clear
[base 2147483648]
[ditch-empty-list [bool] [popd] [pop] ifte]
[bool-to-int [0] [1] branch]
[uncons-two [uncons] ii swapd]
[sandwich swap [cons] dip swoncat]
[build-list [i cons] genrec]
[digitalize [0 <=] [pop []] [base divmod swap] build-list]
[to-bigint [!-] [abs digitalize] cleave cons]
[from-bigint sign-int neg-if-necessary]
[sign-int [first] [prep from-bigint'] cleave]
[neg-if-necessary swap [neg] [] branch]
[prep rest 1 0 rolldown]
[from-bigint' [next-digit] step popd]
[next-digit [increase-power] [accumulate-digit] clop popdd]
[increase-power popop base *]
[accumulate-digit rolldown * +]
[neg-bigint [not] infra]
[add-with-carry _add-with-carry0 _add-with-carry1]
[_add-with-carry0 [bool-to-int] dipd + +]
[_add-with-carry1 base [mod] [>=] clop]
[add-carry-to-digits [pop not] [popd] [_actd_R0] build-list]
[_actd_R0 [bool] [_actd_R0.then] [_actd_R0.else] ifte]
[_actd_R0.else popd 1 false rolldown]
[_actd_R0.then 0 swap uncons [add-with-carry] dip]
[add-digits initial-carry add-digits']
[initial-carry false rollup]
[same-sign [first] ii xor not]
[extract-sign [uncons] dip rest]
[add-like-bigints extract-sign add-digits cons]
[add-bigints [same-sign] [add-like-bigints] [neg-bigint sub-like-bigints] ifte]
[build-two-list-combiner _btlc0 _btlc1 [build-list] ccons cons]
[_btlc0.0 [[ditch-empty-list] swoncat] dip]
[_btlc0.1 [pop] swoncat]
[_btlc0.3 [_btlc0.0 _btlc0.1] dip]
[_btlc0.4 [uncons-two] [dipd] sandwich]
[_btlc0 _btlc0.3 _btlc0.4]
[_btlc1 [[ifte] ccons [P'] swons [P] swap] dip]
[P [bool] ii & not]
[P' [bool] ii |]
[carry [] [1 swons] branch]
[compare-pairs [bool not] [pop false] [_comp-pairs0] [_comp-pairs1] genrec]
[_comp-pairs0 [first [>=] infrst] [pop true]]
[_comp-pairs1 [rest] swoncat ifte]
[check-gt [gt-bigint] [swap [not] dipd] [] ifte]
[gt-bigint <<{} [_gtb_P] [_gtb_BASE] [_gtb_R1] tailrec]
[_gtb_R1 uncons-two [unit cons swons] dipd]
[_gtb_P [bool] ii & not]
[_gtb_BASE [bool] [popop pop true] [_gtb_BASE'] ifte]
[_gtb_BASE' [pop bool] [popop pop false] [popop compare-pairs] ifte]
[sub-carry-from-digits [pop not] [popd] [_scfd_R0] [i cons-but-not-leading-zeroes] genrec]
[_scfd_R0 uncons 0 swap [sub-with-carry] dip]
[cons-but-not-leading-zeroes [P'] [cons] [popd] ifte]
[sub-with-carry _sub-with-carry0 _sub-with-carry1]
[_sub-with-carry0 rolldown bool-to-int [-] ii]
[_sub-with-carry1 [base + base mod] [0 <] cleave]
[sub-like-bigints extract-sign check-gt sub-digits cons]
[sub-digits initial-carry sub-digits']
[sub-bigints [same-sign] [sub-like-bigints] [neg-bigint add-like-bigints] ifte]
enstacken [inscribe] step
[add-carry-to-digits]
[swap carry]
[add-with-carry]
build-two-list-combiner
[add-digits'] swoncat
inscribe
[sub-carry-from-digits]
[swap pop]
[sub-with-carry]
build-two-list-combiner
[sub-digits'] swoncat
inscribe
1000000000000000000000000000000000000000 to-bigint 1 to-bigint sub-bigints from-bigint
+229
View File
@@ -0,0 +1,229 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2022 Simon Forman
#
# This file is part of Thun
#
# Thun is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thun is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Thun. If not see <http://www.gnu.org/licenses/>.
#
'''
Let's grok division (and modulus.)
For now we will deal with both positive
(or at least of the same sign.)
'''
from random import randint
def div_mod(A, B):
'''
A and B are lists of digits, LSB->MSB.
'''
if not A:
return [], []
if not B:
raise ZeroDivisionError()
a_len, b_len = len(A), len(B)
if -1 == cmp_digits(A, B): # A < B
return [], A
# Whew! Okay, we got all that out of the way.
# A > B
A, A_digits = A[:-b_len], A[-b_len:]
if -1 == cmp_digits(A_digits, B):
# Because we know
# A > B AND a_len >= b_len (aka len(A_digits))
# if A_digits < B there must be at least one more
# digit in A:
assert a_len > b_len
A_digits.insert(0, A.pop())
assert -1 < cmp_digits(A_digits, B) # A_digits >= B
q, R = lil_divmod(A_digits, B)
# So we have divided a prefix of A by B
# resulting in a digit q of the answer Q
# and a remainder R that must be extended
# with the more digits of A to make a new
# number N >= B
# what I want to do here is...
'''
___2___
72)145000
-144 = 72 * 2
---
1
B = 72
A_digits = 145
A = 000
q = 2
R = 1
'''
Q, Remainder = foo(A, B, R)
Q.append(q)
return Q, Remainder
def foo(Digits, Divisor, Prefix):
'''E.g.:
___2___
72)145000
-144 = 72 * 2
---
1
Digits = 000
Divisor = 72
Prefix = 1
'''
Quotient = []
while Digits:
Prefix.insert(0, Digits.pop())
if -1 < cmp_digits(Prefix, Divisor): # Prefix >= Divisor
break
Quotient.insert(0, 0)
'''
One iteration through the while loop:
___20__
72)145000
-144| = 72 * 2
---|
10
Another iteration through the while loop:
___20__
72)145000
-144|| = 72 * 2
---||
100 >= 72
Digits = 0
Divisor = 72 (still)
Prefix = 100
At this point Prefix >= Divisor OR Digits == [] OR BOTH
if Prefix < Divisor AND not Digits:
the remainder is Prefix
return Quotient, Prefix
'''
if -1 == cmp_digits(Prefix, Divisor) and not Digits:
return Quotient, Prefix
'''
if Prefix < Divisor AND Digits:
Can't get here
'''
assert -1 < cmp_digits(Prefix, Divisor) # Prefix >= Divisor
q, Remainder = lil_divmod(Prefix, Divisor)
Quotient.insert(0, q)
'''
___20q_
72)145000
-144|| = 72 * 2
---||
100 >= 72
N = 72 * q
---
28 = (100 - N) = (100 - 72q)
Remainder = 28
New_Prefix = Remainder
Digits = 0 (still)
Divisor = 72 (still)
'''
if Digits:
Q, Remainder = foo(Digits, Divisor, Remainder)
Quotient = Q + Quotient
return Quotient, Remainder
def lil_divmod(A, B):
assert -1 < cmp_digits(A, B) # A >= B
assert A and B
# There is a greatest digit in 1..9 such that:
# B * digit <= A
# The obvious thing to do here is a bisect search,
# if we were really just doing 1..9 we could go linear.
# Maybe drive it by the bits in digit?
digit = 9
Q = mul_digit_by_list_of_digits(digit, B)
while 1 == cmp_digits(Q, A): # Q > A
digit = digit - 1
if not digit:
raise ValueError('huh?')
Q = mul_digit_by_list_of_digits(digit, B)
assert -1 < cmp_digits(A, Q)
assert list_to_int(A) >= list_to_int(Q)
remainder = subtract(A, Q)
assert -1 == cmp_digits(remainder, B) # Remainder < Divisor
return digit, remainder
def mul_digit_by_list_of_digits(digit, A):
assert 0 <= digit <= 9
for n in A:
assert 0 <= n <= 9
return int_to_list(list_to_int(A) * digit)
def int_to_list(i):
assert i >= 0
if not i: return []
return list(map(int, str(i)[::-1]))
def list_to_int(A):
if not A: return 0
i = int(''.join(map(str, A[::-1])))
assert i >= 0
return i
def cmp_digits(A, B):
a, b = list_to_int(A), list_to_int(B)
return 1 if a > b else 0 if a == b else -1
def subtract(A, B):
return int_to_list(list_to_int(A) - list_to_int(B))
def try_it(a, b):
A = int_to_list(a)
B = int_to_list(b)
print(f'divmod({list_to_int(A)}, {list_to_int(B)}) = ', end='')
Q, R = div_mod(A, B)
q, r = divmod(a, b)
assert q == list_to_int(Q)
assert r == list_to_int(R)
print(f'{list_to_int(Q)}, {list_to_int(R)}')
for _ in range(10**6):
try_it(
randint(0, 10**randint(8, 15)),
randint(1, 10**randint(1, 15))
)
+75
View File
@@ -0,0 +1,75 @@
import unittest
max_digit = 2**31 - 1
def lil_divmod(A, B):
'''
Return the greatest digit in 1..max_digit such that B * digit <= A
and the remainder A - B * digit.
'''
assert A > 0 and B > 0
assert A >= B
assert B * (max_digit + 1) > A
predicate = lambda n: B * n <= A
digit = find_greatest(1, max_digit, predicate)
remainder = A - digit * B
return digit, remainder
def find_greatest(low, high, f):
'''
Return the highest number n: low <= n <= high for which:
for all i in low..n f(i) is True
-and-
for all i in (n+1)..high f(i) is False.
If the function f::int->bool doesn't behave like above
then I don't know what this function will do.
There must be some number in the range or this function will
fail with an assertion error. (If you turn off assertions
it will succeed and return low in such a case.)
'''
assert low <= high
if f(high):
return high
pivot = (low + high) >> 1
# If there isn't a pivot between low and high that means there's only
# two numbers it could be: low or high, and we already know it isn't
# high from the test above so it must be low.
if low == pivot:
assert f(low) and not f(low + 1)
return low
assert low < pivot < high
return (
find_greatest(pivot, high - 1, f)
if f(pivot) else
find_greatest(low, pivot - 1, f)
)
class find_greatest_Test(unittest.TestCase):
def test_find_greatest(self):
k = 23300
a = 1
b = 2**31-1
f = lambda n: n <= k
n = find_greatest(a, b, f)
self.assertEqual(n, k)
class BigIntTest(unittest.TestCase):
def test_to_int(self):
a = 10*max_digit-3
b = 123
a = (max_digit-3) * b
digit, remainder = lil_divmod(a, b)
#print(f'divmod({a}, {b}) == ({digit}, {remainder}) # ? ')
self.assertEqual((digit, remainder), divmod(a, b))
if __name__ == '__main__':
unittest.main()
+20
View File
@@ -0,0 +1,20 @@
[base 2147483648] inscribe
[valid_digit [0 >] [base <] &&] inscribe
[_add_p [bool not] ii &] inscribe
[_add_then pop swap [] [1 swons] branch] inscribe
[_add_rec_pred [bool] ii &] inscribe
[bool_to_int [0] [1] branch] inscribe
[_add-with-carry0 [bool_to_int] dipd + +] inscribe
[_add-with-carry1 base [mod] [>=] clop] inscribe
[add-with-carry _add-with-carry0 _add-with-carry1] inscribe
[uncons-two [uncons] ii swapd] inscribe
[ditch-empty-list [bool] [popd] [pop] ifte] inscribe
[add-carry-to-digits [pop not] [popd] [[bool not] [1 swons popd]] [[0 swap uncons [add-with-carry] dip] swoncat ifte] genrec] inscribe
[THEN0 uncons-two [add-with-carry] dipd] inscribe
[THEN1 i cons] inscribe
[ELSE ditch-empty-list add-carry-to-digits] inscribe
[_add_R0 [_add_rec_pred] [THEN0]] inscribe
[_add_R1 [THEN1] cons concat [ELSE] ifte cons] inscribe
[add_digits [_add_p] [_add_then] [_add_R0] [_add_R1] genrec cons ] inscribe
clear false base -- unit dup concat dup concat [1]
[add_digits] trace