Another kind of pointer arithmetic

Superstar64 Hexagonalstar64 at gmail.com
Sat Jun 27 20:03:30 UTC 2020


On Friday, 26 June 2020 at 14:00:27 UTC, Ianis Vasilev wrote:
> Somebody joked yesterday on Twitter about how pointer levels of 
> indirection can be used to represent natural numbers and how we 
> can do arithmetic with them (I can't find the post right now).
>
> I decided to try and implement adding and multiplying levels of 
> indirection:
> https://gist.github.com/v--/5cbd0046be6fc5dbff9a9ad2f1717cde
>
> I think it turned out fairly trivial.

This appears to be a form of peano numbers. See 
https://wiki.haskell.org/Peano_numbers


More information about the Digitalmars-d mailing list