From a3fe79ec9ad1c22eb288dd7fc32dfcea14b383b1 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 23 Jan 2025 15:34:04 +0100 Subject: Improve Parigot numbers --- std/Number/Conversion.bruijn | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'std/Number/Conversion.bruijn') diff --git a/std/Number/Conversion.bruijn b/std/Number/Conversion.bruijn index 01c7e9f..2f6681a 100644 --- a/std/Number/Conversion.bruijn +++ b/std/Number/Conversion.bruijn @@ -5,6 +5,7 @@ :import std/Number/Unary U :import std/Number/Binary B :import std/Number/Ternary T +:import std/Number/Parigot P # converts unary numbers to ternary unary→ternary [0 T.inc (+0t)] ⧗ Unary → Ternary @@ -24,6 +25,14 @@ ternary→unary [T.apply 0 U.inc (+0u)] ⧗ Ternary → Unary :test (³¹(+0t)) ((+0u)) :test (³¹(+2t)) ((+2u)) +# converts Parigot numbers to unary +parigot→unary [[[P.iter 0 1 2]]] ⧗ Parigot → Unary + +ᵖ¹‣ parigot→unary + +:test (ᵖ¹P.zero) ((+0u)) +:test (ᵖ¹(P.inc (P.inc P.zero))) ((+2u)) + # converts binary numbers to ternary # constructs reversed path of composed functions and applies to ternary binary→ternary [y [[[rec]]] [0] 0 (+0t)] ⧗ Binary → Ternary -- cgit v1.2.3