Skip to content

Instantly share code, notes, and snippets.

@alexy
Created March 24, 2012 22:32
Show Gist options
  • Save alexy/2188668 to your computer and use it in GitHub Desktop.
Save alexy/2188668 to your computer and use it in GitHub Desktop.
Why manifest is needed?
def evenlyN[T](a: Array[T], n: Int): Array[T] = {
if (n < 1 || a.size < n) return a
val step = (a.size + 1) / n
val indices = (1 to n) map (_*step)
(indices map (a(_))).toArray
}
<console>:12: error: could not find implicit value for evidence parameter of type ClassManifest[T]
(indices map (a(_))).toArray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment