title: Injecting a variable definition into F# quotation
body: <p>I have a custom variable definition, that I want to insert into a quotation. Is it even possible with the quotations syntax sugar?</p>
  
  <p>What I wanted to do:</p>
  
  <pre><code>open Microsoft.FSharp.Quotations
  let var = Var("myvar", typeof&lt;int&gt;)
  let op = &lt;@@ fun l -&gt; match l with
          | [] -&gt; 0
          | %%myvar :: _ -&gt; ... @@&gt;
  </code></pre>
  
  <p>I've also tried <code>&lt;@@ let %%myvar = ... @@&gt;</code> with a similar purpose.</p>
  
  <p>In both cases I got FS0010 "Unexpected prefix operator in binding", or "... in pattern matching".</p>
  
  <p>Is there a way to inject an existing Var like this? Or do I have to resort to manually generating the entire expression?</p>
  
  <p>PS: I am using the whole thing to translate some other AST into an F# quotation.</p>