anchor.diff:      | LambdaN (inputs, body) ->
         let (te, ll) = constructTopLevelLets boundVars body
         (LambdaN (inputs, te), ll)
  +    | Patterns.IfThenElse(cond, e1, e2) ->
  +      let (te1, liftedLets1) = constructTopLevelLets boundVars e1
  +      let (te2, liftedLets2) = constructTopLevelLets boundVars e2
  +      let (tc, liftedLetsc) = constructTopLevelLets boundVars cond
  +      (Expr.IfThenElse(tc, LetN(liftedLets1, te1), LetN(liftedLets2, te2)), liftedLetsc)
  +    | ExprShape.ShapeCombination(o, exprs) ->
  +      let (tes, lls) = List.unzip (List.map (constructTopLevelLets boundVars) exprs)
  +      (ExprShape.RebuildShapeCombination(o, tes), List.concat lls)
       | _ -> (exp, [])
     let (inputs, body) = match e with TopLevelFunction (i, b) -> (i, b)
     let (te, ll) = constructTopLevelLets inputs body
  
positive.code:   let id = variable_counter
    sprintf "%s%d" name id
  
  (* C code generation for a type *)
  let rec ccodegenType (t: System.Type): string = 
    match t with 
    | _ when t = typeof<Matrix> -> "array_array_number_t"
    | _ when t = typeof<Vector> -> "array_number_t"
    | _ when (t = typeof<Number>) -> "number_t"
    | _ when (t = typeof<AnyNumeric>) -> "value_t"
    | _ when (t = typeof<Index>) -> "index_t"
  
negative.code:   | Patterns.Lambda (x, body) -> Expr.Lambda(x, anfConversion false body)
    | Patterns.NewArray(tp, elems) when not letRhs -> 
      let variable = new Var(newVar "array", e.Type)
      Expr.Let(variable, Expr.NewArray(tp, List.map (anfConversion false) elems), Expr.Var(variable))
    | Patterns.IfThenElse(cond, e1, e2) when not letRhs ->
      let variable = new Var(newVar "ite", e.Type)
      Expr.Let(variable, Expr.IfThenElse(cond, anfConversion false e1, anfConversion false e2), Expr.Var(variable))
  