This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.parsing.combinator._ | |
class Tree[L](val label: L, val children: Seq[Tree[L]]) extends Traversable[Tree[L]] { | |
val numOfChildren = children.length | |
def this(label: L) = this(label, Seq[Tree[L]]()) | |
override def toString: String = { | |
if (isTerminal) { | |
return label.toString |
NewerOlder