Syntax for Indexing: Why [] is an Antiquated Standard

val data = ... // Some large sequence of values
val indices = 1 to 100 by 3 // the indices you want in your slice
val slice = indices.map(data)
val stateData: Map[String, StateData] = ...
val interestingStates: Set[String] = Set("Texas", "Ohio", ...)
val interestingData = stateData.filterKeys(interestingStates)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mark Lewis

Mark Lewis

Computer Science Professor, Planetary Rings Simulator, Scala Zealot