hand-rolled map
I was watching this awesome talk tonight by Kelsey Gilmore-Innis and it got me thinking about Scala’s source code. So I decided to dive into the code and read their implementation of the standard map
function over a collection.
Well, read is a strong word. More like stare at the screen that contained Scala source code and attempt to decipher it. Here’s where I wound up.
Got tired, couldn’t find it, decided to write a quick implementation to test my understanding of a for/yield or a for-comprehension.
Basically, it’s a function that takes a list and another function as args, and returns a new list with the passed-in function applied to each member of the original list.