0
首先我有一个二叉树类型声明:Scala的函数编程操作:::
sealed trait BT[+A]
case object Empty extends BT[Nothing]
case class Node[+A](elem:A, left:BT[A], right:BT[A]) extends BT[A];;
而且进一步,我有此代码为序遍历这个谜找运营商“:::”。
这个运算符“:::”在这段代码中意味着什么?
def inorder[A](tree: BT[A]): List[A] = {
tree match {
case Node(v,l,r) =>(inorder(l)) ::: (v::(inorder(r)))
case Empty => Nil
}
}