0

Does such collection exist?

At the moment the code I have doesn't compile:

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 are:

  • forward reference extends over definition of value d
  • forward reference extends over definition of value c
  • forward reference extends over definition of value b
  • forward reference extends over definition of value a
4

0 回答 0