Split-Bill

This is a command-line expense-sharing utility written in Rust. It takes NAME=AMOUNT pairs (or just NAME if a person had no expenses) and produces a very simple output about how much each person should return or get back for the expenses to be settled.

Repository: split-bill

Example

$ ./target/debug/split-bill john=10 jane=15 luke margaret dude=5
Expenses:
- john: 10
- jane: 15
- luke: 0
- margaret: 0
- dude: 5
john Gets(4.0)
jane Gets(9.0)
luke Pays(6.0)
margaret Pays(6.0)
dude Pays(1.0)

Ideas

  • Let the application store expenses between runs. Running it several times would add expenses to a database and refresh the report.
  • Use a reasonable type to represent amounts — f32 will break calculations sooner or later.
  • Extract expense calculation code to a Rust library and then use it in the CLI tool, to be able to then write other applications (GUI maybe?).
  • Use Itertools.permutations to generate a sequence of permutations of debts to try them until a transaction plan is identified that ensures minimum number transactions.