Search Results

Search found 3 results on 1 pages for 'adam77'.

Page 1/1 | 1 

  • Scala: is it possible to override default case class constructor?

    - by adam77
    Just wondering if this is possible. What I would actually like to do is check and possibly modify one of the arguments before it is stored as a val. Alternatively, I could use an overload and make the default constructor private. In which case I would also like to make private the default factory constructor in the companion object, how would I do that? Many thanks. Adam

    Read the article

  • Best way to score and sum in Scala?

    - by adam77
    Is there a better way of doing this: val totalScore = set.foldLeft(0)( _ + score(_) ) or this: val totalScore = set.map(score(_)).sum I think it's quite a common operation so was expecting something sleeker like: val totalScore = set.sum( score(_) )

    Read the article

1