Skip to content

Instantly share code, notes, and snippets.

@smerrill
Created September 9, 2010 00:47
Show Gist options
  • Save smerrill/571149 to your computer and use it in GitHub Desktop.
Save smerrill/571149 to your computer and use it in GitHub Desktop.
def verify(a:String) = {(10 - a.reverse.tail.zip(Stream.continually(List(2, 1)).flatten).foldLeft(0)((sum, vals) => sum + (vals._1.toString.toInt * vals._2).toString.toList.foldLeft(0)(_+_.toString.toInt)) % 10).toString.last.toString.toInt == a.last.toString.toInt}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment