Skip to content

krusek/digits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

digits

This package performs arbitrary precision integer arithmetic. It is a functional approach to arbitrary precision integers. Most of the methods are recursive methods with just a single switch statement.

It contains one main enumeration: BinaryInteger.

BinaryInteger

Binary is just a linked list. It is a linked list whose elements are ones and zeros and the tail is either .empty(.postive) or .empty(.negative). The positive one indicates an infinite stream of zeros whereas the negative one indicates an infinite stream of ones. It represents an arbitrary precision integer. It supports positive powers, addition, subtraction, multiplications, division, and modulus.

Inspiration

I'm a big fan of functional programming because it feels so mathematical. I was inspired to create this repository when I was reading through this book and translating the examples from Standard ML into Swift.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages