Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 808 Bytes

README.md

File metadata and controls

31 lines (20 loc) · 808 Bytes

calculate

Download

A Scala implementation of a calculator to illustrate Functional Programming concepts like ADTs, Implicits and Typeclasses

Using the library in a new project

Add the following to your build.sbt

resolvers += Resolver.bintrayRepo("ajatix", "scala")

libraryDependencies += "io.github.ajatix" %% "calculate" % "0.3"

In your main application, your can run the following

import io.github.ajatix.calculate.ExpressionDSL._

object Calculate extends App {

  val e = 3 into 4 plus 3 by 3 minus 4

  println(e)
  println(e.reorder())
  println(e.reorder().optimize())
  println(e.reorder().optimize().evaluate())

}