title: Making sense of Julia's do-blocks with functions
body: <p>Looking at the <code>get</code> function of base Julia, it is <a href="http://www.jlhub.com/julia/manual/en/function/get" rel="nofollow noreferrer">apparently</a> intended to be used using a do-block:</p>
  <pre><code>  get(dict, key) do
        # default value calculated here
        time()
    end
  </code></pre>
  <p>The signature for <code>get</code> is <code>get(Dictionary_name, Key_name, Default Value)</code>. This means that the do-block automatically inserts the default value as the last argument of <code>get</code>.</p>
  <p>When I compare this syntax for the do-block with the one in <a href="https://discourse.julialang.org/t/what-does-this-do-syntax-mean/25041/3" rel="nofollow noreferrer">this</a> thread, I notice a difference:</p>
  <pre><code>my_function(f, container) = begin
      for element in container
          f(element)
      end
      return nothing
  end
  
  my_function([1,2,3]) do x  # equivlent to my_function(print, [1,2,3])
      print(x)
  end
  </code></pre>
  <p>Notice how the function <code>f</code> is the very first argument of <code>my_function</code>, so the do-block inserts <code>print</code> as the first argument of <code>my_function</code>, not the last.</p>
  <p>This is my confusion: Why is it that the do-block in one example inserts the variable as the last argument, but in another inserts in as the first?</p>