-
Notifications
You must be signed in to change notification settings - Fork 10
NaturalNumber
Michael Poteat edited this page Feb 27, 2023
·
3 revisions
hkt-toolbelt / NaturalNumber
Ƭ _$add<A
, B
, A_LIST
, B_LIST
, SUM_LIST
, SUM
>: SUM
Name | Type |
---|---|
A |
extends Number
|
B |
extends Number
|
A_LIST |
extends DigitList = _$toList <A > |
B_LIST |
extends DigitList = _$toList <B > |
SUM_LIST |
extends DigitList = _$add <A_LIST , B_LIST > |
SUM |
_$fromString <_$toString <SUM_LIST >> |
Ƭ _$compare<A
, B
, A_LIST
, B_LIST
, RESULT
>: RESULT
Name | Type |
---|---|
A |
extends Number
|
B |
extends Number
|
A_LIST |
extends DigitList = _$toList <A > |
B_LIST |
extends DigitList = _$toList <B > |
RESULT |
extends -1 | 0 | 1 = _$compare <A_LIST , B_LIST > |
Ƭ _$decrement<A
, A_LIST
, DECREMENT
, RESULT
>: RESULT
Name | Type |
---|---|
A |
extends Number
|
A_LIST |
extends DigitList = _$toList <A > |
DECREMENT |
extends DigitList = _$decrement <A_LIST > |
RESULT |
extends Number = _$fromString <_$toString <DECREMENT >> |
Ƭ _$divide<A
, B
, A_LIST
, B_LIST
, QUOTIENT_LIST
, QUOTIENT
>: QUOTIENT
Name | Type |
---|---|
A |
extends Number
|
B |
extends Number
|
A_LIST |
extends DigitList = _$toList <A > |
B_LIST |
extends DigitList = _$toList <B > |
QUOTIENT_LIST |
extends DigitList = _$divide <A_LIST , B_LIST > |
QUOTIENT |
_$fromString <_$toString <QUOTIENT_LIST >> |
Ƭ _$increment<A
, A_LIST
, INCREMENT
, RESULT
>: RESULT
Name | Type |
---|---|
A |
extends Number
|
A_LIST |
extends DigitList = _$toList <A > |
INCREMENT |
extends DigitList = _$increment <A_LIST > |
RESULT |
extends Number = _$fromString <_$toString <INCREMENT >> |
Ƭ _$isEven<T
, LIST
, RESULT
>: RESULT
Name | Type |
---|---|
T |
extends Number
|
LIST |
extends DigitList = _$toList <T > |
RESULT |
_$isEven <LIST > |
Ƭ _$isOdd<T
, LIST
, RESULT
>: RESULT
Name | Type |
---|---|
T |
extends Number
|
LIST |
extends DigitList = _$toList <T > |
RESULT |
_$isOdd <LIST > |
Ƭ _$modulo<A
, B
, A_LIST
, B_LIST
, MODULUS_LIST
, MODULUS
>: MODULUS
Name | Type |
---|---|
A |
extends Number
|
B |
extends Number
|
A_LIST |
extends DigitList = _$toList <A > |
B_LIST |
extends DigitList = _$toList <B > |
MODULUS_LIST |
extends DigitList = _$modulo <A_LIST , B_LIST > |
MODULUS |
_$fromString <_$toString <MODULUS_LIST >> |
Ƭ _$multiply<A
, B
, A_LIST
, B_LIST
, PRODUCT_LIST
, PRODUCT
>: PRODUCT
Name | Type |
---|---|
A |
extends Number
|
B |
extends Number
|
A_LIST |
extends DigitList = _$toList <A > |
B_LIST |
extends DigitList = _$toList <B > |
PRODUCT_LIST |
extends DigitList = _$multiply <A_LIST , B_LIST > |
PRODUCT |
_$fromString <_$toString <PRODUCT_LIST >> |
Ƭ _$subtract<A
, B
, A_LIST
, B_LIST
, SUB_LIST
, RESULT
>: RESULT
Name | Type |
---|---|
A |
extends Number
|
B |
extends Number
|
A_LIST |
extends DigitList = _$toList <A > |
B_LIST |
extends DigitList = _$toList <B > |
SUB_LIST |
extends DigitList = _$subtract <A_LIST , B_LIST > |
RESULT |
_$fromString <_$toString <SUB_LIST >> |
Ƭ _$toList<S
, O
>: _$toString
<S
> extends `${infer Head}${infer Tail}` ? _$toList
<Tail
, [...O, Head
]> : O
extends DigitList
? O
: ["0"
]
Name | Type |
---|---|
S |
extends Number
|
O |
extends string [] = [] |