Skip to content

Instantly share code, notes, and snippets.

@scsibug
Created February 1, 2012 23:32
Show Gist options
  • Save scsibug/1720154 to your computer and use it in GitHub Desktop.
Save scsibug/1720154 to your computer and use it in GitHub Desktop.
string list size (7 languages in 7 weeks, Scala chapter)
val x = List("a", "aoe", "", "foo")
val sum = x.foldLeft(0)(_ + _.length)
println(x.mkString + " --> " + sum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment