sragu / multiplier

multiplication using peasant tables

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

multiplier

multiplication using peasant tables

Reference - http://mathforum.org/dr.math/faq/faq.peasant.html

Languages

Java, JavaScript ES6(Babel), Rust, Swift3

Approach

  • straight forward implementation of the algorithm.
  • source and tests in same directory where possible
  • Peasant tables is built using a Generator where available, or an Iterator otherwise.

Build

  • Uses Bazel for building java/rust
  • Uses npm for building javascript
  • Uses Swift Package Manager for Swift (on linux w/ docker)

Start

  • Get Bazel installed - brew install bazel
  • Get NodeJs installed - brew install node
  • Run ./go

Miscellaneous

  • Swift - under src/swift, you will find start/run scripts which will help to execute Swift code/tests

Learnings

  • Bazel is quite fast, incrementally builds only new changes - but quite hard to grasp the project due to scattered build files.
  • Java8 streams/lambdas makes the language a decent choice for once (not considering the awesomeness of JVM).
  • JavaScript generators and other ES6 sytnax improvements are pretty neat.
  • Rust lang concept of borrow/lifetimes are quite neat and warns you of potential mistakes.
  • Swift3 error messages are super friendly, even highlighted where classes are renamed between versions.
  • Rust/Swift/Java don't have concept of generators, only iterators

About

multiplication using peasant tables


Languages

Language:Java 35.0%Language:Starlark 16.6%Language:Swift 14.6%Language:JavaScript 11.9%Language:Rust 9.3%Language:Shell 7.9%Language:OCaml 4.7%