Combining string and expression interpolation
<p>I'm having trouble combining expression and string interpolation. I want to do something like this:</p>

<pre><code>a = [:foo, :bar]
b = [:printfoo, :printbar]

for (str, fn) in zip(a,b)
  @eval begin
    """ 
    ```
    $fn()
    ```
    Prints $str.
    """
    $fn() = println("$str")
  end 
end
</code></pre>

<p>My desired output are two functions, one which might look, as typed, like</p>

<pre><code>"""    
```
printfoo()
```
Prints foo.
"""
printfoo() = println("foo")
</code></pre>

<p>Instead, I get expressions that look like this (when I use <code>quote</code> rather than <code>@eval begin</code>):</p>

<pre><code>```\n$(fn)()\n```\nPrints $(str).\n" # /home/..., line 12:
    printfoo() = begin  # /home/..., line 12:
            println("$(str)")
        end
</code></pre>

<p>I don't understand why using the same <code>$x</code> syntax, interpolation is performed as I want only outside of quoted (<code>"..."</code>) regions. I've tried some combinations of <code>$($x)</code> etc. but am missing some of the subtleties:</p>

<ul>
<li><code>"$str"</code> -> <code>"$(str)"</code></li>
<li><code>"$($str)"</code> -> <code>"$(foo)"</code></li>
</ul>

<p>What would map to <code>"foo"</code>?</p>

<p>Thanks.</p>