anchor.diff:      let asExpr x = AsExpression x
       let asExpression x = (x :> Expression)
   
  -    let bindingFlags = BindingFlags.Public ||| BindingFlags.NonPublic
  -    let instanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly
  -    let isNamedType(typ:Type) = not (typ.IsArray || typ.IsByRef || typ.IsPointer)
  -    let equivHeadTypes (ty1:Type) (ty2:Type) = 
  -        isNamedType(ty1) &&
  -        if ty1.IsGenericType then 
  -          ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition())
  -        else 
  -          ty1.Equals(ty2)
  -
  -    let isFunctionType typ = equivHeadTypes typ (typeof<(int -> int)>)
       let getFunctionType typ = 
  -        if not (isFunctionType typ) then invalidArg "typ" "cannot convert recursion except for function types"
  +        let isFunctionType typ =
  +            let equivHeadTypes (ty1:Type) (ty2:Type) = 
  +                let isNamedType (typ:Type) =
  +                    not (typ.IsArray || typ.IsByRef || typ.IsPointer)
  +    
  +                isNamedType(ty1) &&
  +                    if ty1.IsGenericType then 
  +                      ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition())
  +                    else 
  +                      ty1.Equals(ty2)
  +
  +            equivHeadTypes typ (typeof<(int->int)>)
  +
  +        if not (isFunctionType typ) then
  +            invalidArg "typ" "cannot convert recursion except for function types"
  +
           let tyargs = typ.GetGenericArguments()
           tyargs.[0], tyargs.[1]
   
  
positive.code:     let (|ArrayTypeQ|_|) (ty:System.Type) = if ty.IsArray && ty.GetArrayRank() = 1 then Some(ty.GetElementType()) else None
      
      /// Convert F# quotations to LINQ expression trees.
      /// A more polished LINQ-Quotation translator will be published
      /// concert with later versions of LINQ.
      let rec ConvExpr (env:ConvEnv) (inp:Expr) = 
          match LetRecConvExpr env None inp with
          | AsExpression expr -> expr
  
negative.code:             Expression.Assign (linqVariable, linqValue)|> asExpr
  
          | Patterns.Lambda (firstVar, firstBody) as lambda ->
              let rec getArguments args maybeBody = function
              | Lambda (v, body) -> getArguments (v::args) (Some body) body
              | _ -> List.rev args, maybeBody.Value
  
              let arguments, body =
                  getArguments [] None lambda
  
              let capturedVars =
                  let parameterVars = Set arguments
  
                  body.GetFreeVars ()
                  |> Seq.filter (fun freeVar -> not <| Set.contains freeVar parameterVars)
                  |> Seq.sortBy (fun freeVar -> freeVar.Name)
                  |> Seq.toList
  
              let argsCount = arguments.Length
              if argsCount > 19 then
                  // due to limitations of compiling linq quotations we have this fallback where we just pop
                  // off a single argument and try again. This gives very poor runtime performance, but I'm
                  // guessing (hoping?) that there aren't too many real world functions that have > 19 arguments.
                  let v, body = firstVar, firstBody
  
                  let vP = ConvVar v
                  let env = { env with varEnv = Map.add v (vP |> asExpression) env.varEnv }
                  let tyargs = [| v.Type; body.Type |]
                  let bodyP = ConvExpr env body
                  let convType = typedefof<System.Converter<obj,obj>>.MakeGenericType tyargs
                  let convDelegate = Expression.Lambda(convType, bodyP, [| vP |]) |> asExpression
                  Expression.Call(typeof<FuncConvert>,"ToFSharpFunc",tyargs,[| convDelegate |]) |> asExpr
              else
                  let stateType, makeStateConstructor =
                      match capturedVars |> List.map (fun v -> v.Type) |> List.toArray with
                      | [|t|] -> t, (fun x -> Seq.head x)
  