anchor.diff:              | head :: tail when p head -> loop (head :: acc) tail
               | _ -> List.rev acc
           loop [] xs
  +
  +    /// Fold over the list passing the index and element at that index to a folding function
  +    let foldi (folder:'State -> int -> 'T -> 'State) (state:'State) (xs:'T list) =        
  +        match xs with 
  +        | [] -> state
  +        | _ -> 
  +            let f = OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt folder
  +            let rec loop idx s xs = 
  +                match xs with 
  +                | [] -> s
  +                | h::t -> loop (idx+1) (f.Invoke(s,idx,h)) t
  +            loop 0 state xs
   
   [<RequireQualifiedAccess>]
   [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
  
positive.code:                | "" -> str, None
                 | index -> str.Substring (0, str.Length - index.Length), Some (int index)
  
      let trim (value: string) = match value with null -> null | x -> x.Trim()
      
      let split options (separator: string[]) (value: string) = 
  
negative.code:             line := reader.ReadLine()
          |]
  
      open System.Text
      /// Use an accumulation function to create a new string applying a transformation
      /// to every non-empty line in the string
      let mapNonEmptyLines (folder: StringBuilder -> string -> StringBuilder) (str: string) =
          let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt folder
          use reader = new StringReader (str)
          let sb = StringBuilder ()
          let mutable line = reader.ReadLine ()
          while isNotNull line do
              if line.Length > 0 then
                  f.Invoke (sb,line) |> ignore
              line <- reader.ReadLine()
          string sb
  
      /// Parse a string to find the first nonempty line
      /// Return null if the string was null or only contained empty lines
      let firstNonEmptyLine (str: string) =
          use reader = new StringReader (str)
          let rec loop (line:string) =
              if isNull line then None 
              elif  line.Length > 0 then Some line
              else loop (reader.ReadLine())
          loop (reader.ReadLine())
  
  module Reflection =
      open System.Reflection
  
  