title: Step-by-step connection between a Scala high-order function to provided examples
body: <p>I'm having difficulty figuring out how to make the jump from a Scala high-order function definition to the example provided. It was provided in <a href="http://marakana.com/static/courseware/scala/presentation/scala%20%3E%20java.html" rel="nofollow noreferrer">this slide show</a> on <a href="http://marakana.com/static/courseware/scala/presentation/scala%20%3E%20java.html#slide-81" rel="nofollow noreferrer">slide 81</a>.</p>
  
  <p>Here's the high-order function definition:</p>
  
  <pre><code>trait X[A] { def map[B](f: A =&gt; B): X[B] }
  </code></pre>
  
  <p>Here's the examples provided:</p>
  
  <pre><code>(1 to 10) map { x =&gt; x * 2 } // evaluates to Vector(2, 4, ..., 20)
  (1 to 10) map { _ * 2 }      // shorthand!
  </code></pre>
  
  <p>Huh?! There just HAS to be some steps in here I am missing. I get that the examples may be leveraging both the function definition AND some Scala niceties. I just don't have enough experience reading Scala and making the connecting assumptions yet.</p>
  
  <p>My background is as a Java OO. I am now learning Scala and functional programming. And this is not the first example like this I have not understood. It's just the first one where I felt I had the courage to post knowing I would look ignorant.</p>
  
  <p>I did try to research this. First, I went to the Scala "bible", <a href="https://rads.stackoverflow.com/amzn/click/com/0981531644" rel="nofollow noreferrer" rel="nofollow noreferrer">"Programming in Scala 2nd Edition"</a>, and attempted to make sense of if from there (pages 165-9). Then, I did a search here on StackOverflow. And I found several links that talk around the area. But, nothing actually shows me, STEP-BY-STEP, the connection between a Scala high-order function definition and the provided examples in a way that maps to the particular instance in this slide.</p>
  
  <p>Here's what I found on StackOverflow:</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/5014762/scala-workshop-advice">Scala: Workshop Advice</a></li>
  <li><a href="https://stackoverflow.com/questions/7337582/more-on-generic-scala-functions">More on generic Scala functions</a></li>
  <li><a href="https://stackoverflow.com/questions/1252915/scala-how-to-define-generic-function-parameters">Scala: How to define &quot;generic&quot; function parameters?</a></li>
  </ol>
  
  <p>I'm just now realizing that I skipped Google and came straight to StackOverflow. Hmmm. If you google and find just the right link, I would love seeing it. I've run out of time to sift through all the Google links which use terms like monkey-monad, blastomorphisms, etc. while leaving me even more confused and less likely to try and figure this out.</p>