这样的收藏是否存在?
目前我编写的代码没有编译:
object pagerank {
// TODO fixme
val totalNodes: BigDecimal = 4
class Node(in: => List[Node], out: => List[Node]) {
def rank: BigDecimal = {
in.foldLeft(BigDecimal(0))((sum, node) => sum + node.rank) + (1 / totalNodes / out.size)
}
}
val d: Node = new Node(Nil, List(a, b, c))
val b: Node = new Node(List(d), List(a, c))
val c: Node = new Node(List(b, d), List(a))
val a: Node = new Node(List(b, c, d), Nil)
b.rank
}
Erros是: