Skip to content

Instantly share code, notes, and snippets.

@chrismay
Created June 26, 2011 06:29
Show Gist options
  • Save chrismay/1047316 to your computer and use it in GitHub Desktop.
Save chrismay/1047316 to your computer and use it in GitHub Desktop.
def toQuadList()= {
def lrQuadsFromLine(line: List[Int], accumulator: List[List[Int]]): List[List[Int]] = {
if (line.length < 4)
accumulator
else
lrQuadsFromLine(line.tail, accumulator :+ line.slice(0, 4))
}
data.flatMap(line => lrQuadsFromLine(line, List.empty))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment