Skip to content

Commit

Permalink
Lazily compute intervals to persist
Browse files Browse the repository at this point in the history
  • Loading branch information
phearnot committed Aug 15, 2017
1 parent 59002de commit d068674
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ object BlockchainUpdaterImpl {
blockchainUpdater
}

def ranges(from: Int, to: Int, by: Int): List[(Int, Int)] =
def ranges(from: Int, to: Int, by: Int): Stream[(Int, Int)] =
if (from + by < to)
(from, from + by) +: ranges(from + by, to, by)
else List((from, to))

(from, from + by) #:: ranges(from + by, to, by)
else
(from, to) #:: Stream.empty[(Int, Int)]
}

0 comments on commit d068674

Please sign in to comment.