anchor.diff: -module Demo
  +namespace JSEmbedding
   
   open System.Runtime.InteropServices
   open System
  
positive.code:         // a FSLump
          let extract_fslump (arg: JSLump) =
              let index = IdType(V8.get_pointer_lump((arg :> Lump).Pointer))
              fs_values.[index]
  
          // process_arg takes an argument
          let process_arg (arg: JSLump) =
              let lumpy_arg = arg :> Lump
              if (V8.get_pointer_lump(lumpy_arg.Pointer)) = -1 then lumpy_arg
              else extract_fslump(arg)
      
          let evaluator context args =
              // the JSLumps that contain a pointer to a FSLump are processed into that FSLump
              let processed_args = args |> get_all_JS_arguments JSLump.Context |> Array.map process_arg
              printf "these are processed_args %A\n" (Array.toList processed_args)
              let result = eval_array (processed_args.[0]) (Array.toList (processed_args.[1..]))
              printf "this is the result %A\n" <| get_fslump_value(result)
              // return the pointer to a FLump object (in JavaScript)
  
negative.code:     
          with
              | :? System.IndexOutOfRangeException -> false
              
      // since func can be a curried function, it acts as an accumulator argument
      let rec eval_array (func: Lump) (arg: Lump list) =
  
          // This function takes two Lumps: a function (which will be an FSLump)
          // and an argument (it could be a JSLump or FSLump). It returns the result as an
          // FSLump upcasted to a Lump
          let eval (func: Lump) (arg: Lump) =
              if not func.Native then failwith("the function is not an FSLump")
      
              // check func is a function
              let generic_func = typedefof<Microsoft.FSharp.Core.FSharpFunc<_,_>>
              let is_function_okay = check_function_type func
      
              if not is_function_okay then failwith("the first argument doesn't contain a function inside the FSLump or the function is not appropriate for the arguments it was called with")
  
              // get f as object
              let f = get_fslump_value func
              printf "eval called once\n"
      
              // if the argument is a FSLump, extract its value as an object,
              // otherwise box the JSLump into an object
              let a = if arg.Native then (get_fslump_value arg) else box(arg)
      
      
              // the type that fun takes in
              let in_type = func.GetType().GetGenericArguments().[0].GetGenericArguments().[0]
              // the type that fun returns
              // first genericarguments is the type of Lump that func is
              // second generic arguments is the input type (0) and return type of the function (1)
              let return_type = func.GetType().GetGenericArguments().[0].GetGenericArguments().[1]
      
              // the type of arg
              let actual_in_type =
                  if arg.Native then arg.GetType().GetGenericArguments().[0]
                  else arg.GetType()
          
              // type mismatch
              if in_type <> actual_in_type then failwith("type mismatch")
      
              let result = apply_func f a
              
          
              let generic_lump = typedefof<FSLump<_>>
              // Type of the FSLump<return_type>
              let return_lump_type = generic_lump.MakeGenericType(return_type)
              let return_constructor = return_lump_type.GetConstructors().[0]
              
              // construct FSLump<return_type>(result)
              let return_lump = return_constructor.Invoke([| result; fscontext |])
              return_lump :?> Lump
  
  
          match arg with
              | x::xs -> eval_array (eval func x) xs
              | [] -> func
  