Skip to main content
Code Review

Return to Revisions

2 of 2
it was not a right-fold

A left-fold is an elegant solution too:

class Node (children:List[Node], value:Int) {
 def totalCost : Int = (value /: children) (_ + _.totalCost)
}
default

AltStyle によって変換されたページ (->オリジナル) /