I was bored so here is Binary addition in TypeScript (types). This isn't a good way to do addition in TypeScript but it is funny and fairly readable, you can clearly tell what's going on here even if you'd rather not.
TypeScript Playground link so you can actually see it in action.
// Inhale, inscribe.
const ᛚ = Symbol()
const ᛞ = Symbol()
type False = typeof ᛞ;
type True = typeof ᛚ;
type Bit = False | True;
type Not<B extends Bit> = B extends True ? False : True;
type Or<A extends Bit, B extends Bit> = A extends True ? True : B extends True ? True : False
type And<A extends Bit, B extends Bit> = A extends True ? B extends True ? True : False : False
type Xor<A extends Bit, B extends Bit> = And<Or<A, B>, Not<And<A, B>>>
type BSum<S extends Bit, C extends Bit> = [S, C]
type FullAdd<A extends Bit, B extends Bit, C extends Bit> =
BSum<
Xor<Xor<A, B>, C>,
Or<And<A, B>, And<Xor<A, B>, C>>
>
type FATest = FullAdd<False, False, False>;
type Byte<A extends Bit,
B extends Bit,
C extends Bit,
D extends Bit,
E extends Bit,
F extends Bit,
G extends Bit,
H extends Bit> = [A,B,C,D,E,F,G,H];
type Add<A, B> = A extends Byte<
infer AA,
infer AB,
infer AC,
infer AD,
infer AE,
infer AF,
infer AG,
infer AH> ?
B extends Byte<
infer BA,
infer BB,
infer BC,
infer BD,
infer BE,
infer BF,
infer BG,
infer BH> ?
FullAdd<AA, BA, False> extends BSum<infer S1, infer C1> ?
FullAdd<AB, BB, C1> extends BSum<infer S2, infer C2> ?
FullAdd<AC, BC, C2> extends BSum<infer S3, infer C3> ?
FullAdd<AD, BD, C3> extends BSum<infer S4, infer C4> ?
FullAdd<AE, BE, C4> extends BSum<infer S5, infer C5> ?
FullAdd<AF, BF, C5> extends BSum<infer S6, infer C6> ?
FullAdd<AG, BG, C6> extends BSum<infer S7, infer C7> ?
FullAdd<AH, BH, C7> extends BSum<infer S8, infer _C8> ?
Byte<S1, S2, S3, S4, S5, S6, S7, S8>
: never : never : never : never : never : never : never : never
: never : never
type Zero = Byte<False, False, False, False, False, False, False, False>
type One = Byte<True, False, False, False, False, False, False, False>
type Two = Add<One, One>
type Three = Add<One, Two>
type Four = Add<One, Three>
type Five = Add<One, Four>
type Six = Add<One, Five>
type Seven = Add<One, Six>
type Eight = Add<One, Seven>
made with @nex3's syntax highlighter
