Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

SuperFola/polish4s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polish4s

A short program to convert a polish notation string to a Tree, and operates on it.

Example

Either compile it and use the command line:

java -cp polish-notation io.github.superfola.Main "+ * 1 2 3"

Or use Scala to explore the tree:

import io.github.superfola._
import io.github.superfola.types._

object Test extends App {
  val tree: Option[Tree] = Parser("+ * 1 2 3")

  tree.foreach { value =>
    println(value.computed)  // 5.0
    println(value.reduce)    // (2.0 + 3.0)
    println(value.depth, value.length)  // (3, 3)
  }
}

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Languages