import { type StrNum } from "https://deno.land/x/rimbu@1.1.0/typical/index.ts";
const { SubDigit } = StrNum;
Given two string digits, returns a tuple of which the first element is the resulting digit from subtracting the second from the first, and the second element a boolean that is true if there is an 'underflow' or borrow, never otherwise.
Examples
Example 1
Example 1
SubDigit<'5', '3'> => ['2', never]
SubDigit<'3', '6'> => ['7', true]
definition: D2 extends "0" ? [D1, false] : D1 extends D2 ? ["0", false] : Str.Append<D1, D2> extends infer DD ? DD extends ? ["1", U.Extends<DD, "09">] : DD extends ? ["2", U.Extends<DD, "08" | "19">] : DD extends ? ["3", U.Extends<DD, "07" | "18" | "29">] : DD extends ? ["4", U.Extends<DD, >] : DD extends ? ["5", U.Extends<DD, >] : DD extends ? ["6", U.Extends<DD, >] : DD extends ? ["7", U.Extends<DD, >] : DD extends ? ["8", U.Extends<DD, >] : DD extends ? ["9", true] : never : never
| "09"
| "21"
| "32"
| "43"
| "54"
| "65"
| "76"
| "87"
| "98"
| "08"
| "19"
| "31"
| "42"
| "53"
| "64"
| "75"
| "86"
| "97"
| "07"
| "18"
| "29"
| "41"
| "52"
| "63"
| "74"
| "85"
| "96"
| "06"
| "17"
| "28"
| "39"
| "51"
| "62"
| "73"
| "84"
| "95"
| "06"
| "17"
| "28"
| "39"
| "05"
| "16"
| "27"
| "38"
| "49"
| "61"
| "72"
| "83"
| "94"
| "05"
| "16"
| "27"
| "38"
| "49"
| "04"
| "15"
| "26"
| "37"
| "48"
| "59"
| "71"
| "82"
| "93"
| "04"
| "15"
| "26"
| "37"
| "48"
| "59"
| "03"
| "14"
| "25"
| "36"
| "47"
| "58"
| "69"
| "81"
| "92"
| "03"
| "14"
| "25"
| "36"
| "47"
| "58"
| "69"
| "02"
| "13"
| "24"
| "35"
| "46"
| "57"
| "68"
| "79"
| "91"
| "02"
| "13"
| "24"
| "35"
| "46"
| "57"
| "68"
| "79"
| "01"
| "12"
| "23"
| "34"
| "45"
| "56"
| "67"
| "78"
| "89"