anchor.diff:          /// Asynchronous for loop - for all elements from the input sequence,
           /// generate all elements produced by the body (asynchronously). See
           /// also the AsyncSeq.collect function.
  -        member this.For (aseq : AsyncSeq<'T>, mapping : 'T -> AsyncSeq<'TResult>) =
  +        member this.For (source : AsyncSeq<'T>, mapping : 'T -> AsyncSeq<'TResult>) =
               asyncSeq {
  -            let! v = aseq
  +            let! v = source
               match v with
               | Nil -> ()
  -            | Cons(h, t) ->
  -                yield! mapping h
  -                yield! this.For (t, mapping)
  +            | Cons (hd, tl) ->
  +                yield! mapping hd
  +                yield! this.For (tl, mapping)
               }
   
   
  
positive.code:     /// sequentially iterated over (at the maximal possible speed). Disposing of the 
      /// observer cancels the iteration over asynchronous sequence.
      [<CompiledName("ToObservable")>]
      let toObservable (aseq : AsyncSeq<'T>) =
          // Preconditions
          checkNonNull "aseq" aseq
  
          let start (obs : IObserver<_>) =
              async {
                  try
                      for v in aseq do
                          obs.OnNext v
                      obs.OnCompleted()
                  with e ->
                      obs.OnError e }
              |> Async.StartDisposable
  
          { new IObservable<_> with
              member x.Subscribe(obs) = start obs }
  
      /// Converts asynchronous sequence to a synchronous blocking sequence.
      /// The elements of the asynchronous sequence are consumed lazily.
      [<CompiledName("ToBlockingSeq")>]
      let toBlockingSeq (input : AsyncSeq<'T>) =
          // Preconditions
          checkNonNull "input" input
  
          // Write all elements to a blocking buffer and then add None to denote end
          let buf = BlockingQueueAgent<_> (1)
          async {
              do! iterAsync (Some >> buf.AsyncAdd) input
              do! buf.AsyncAdd None }
          |> Async.Start
  
          // Read elements from the blocking buffer & return a sequences
          let rec loop () =
              seq {
              match buf.Get () with
              | None -> ()
              | Some value ->
                  yield value
                  yield! loop () }
          loop ()
  
      /// Create a new asynchronous sequence that caches all elements of the 
      /// sequence specified as the input. When accessing the resulting sequence
      /// multiple times, the input will still be evaluated only once
      [<CompiledName("Cache")>]
      let rec cache (input : AsyncSeq<'T>) : AsyncSeq<'T> =
          // Preconditions
          checkNonNull "input" input
  
          let agent = Agent<AsyncReplyChannel<_>>.Start <| fun agent ->
              async {
              let! repl = agent.Receive ()
              let! next = input
              let res =
                  match next with 
                  | Nil -> Nil
                  | Cons(h, t) ->
                      Cons(h, cache t)
              repl.Reply res
              while true do
                  let! repl = agent.Receive ()
                  repl.Reply res }
  
          //
          async { return! agent.PostAndAsyncReply(id) }
  
      /// Combines two asynchronous sequences into a sequence of pairs. 
      /// The values from sequences are retrieved in parallel.
      [<CompiledName("Zip")>]
      let rec zip (input1 : AsyncSeq<'T1>) (input2 : AsyncSeq<'T2>) : AsyncSeq<_> =
          // Preconditions
          checkNonNull "input1" input1
          checkNonNull "input2" input2
  
          async {
          let! ft = Async.StartChild input1
          let! s = input2
          let! f = ft
          match f, s with
          | Cons(hf, tf), Cons(hs, ts) ->
              return Cons( (hf, hs), zip tf ts)
          | _ -> return Nil }
  
      /// Returns the first N elements of an asynchronous sequence
      [<CompiledName("Take")>]
      let rec take count (input : AsyncSeq<'T>) : AsyncSeq<'T> =
          // Preconditions
          checkNonNull "input" input
  
          async {
          if count > 0 then
              let! v = input
              match v with
              | Nil ->
                  return Nil
              | Cons(h, t) ->
                  return Cons(h, take (count - 1) t)
          else return Nil }
  
      /// Returns elements from an asynchronous sequence while the specified 
      /// predicate holds. The predicate is evaluated asynchronously.
      [<CompiledName("TakeWhileAsync")>]
      let rec takeWhileAsync predicate (input : AsyncSeq<'T>) : AsyncSeq<'T> =
          // Preconditions
          checkNonNull "input" input
  
          async {
          let! v = input
          match v with
          | Nil ->
              return Nil
          | Cons(h, t) ->
              let! res = predicate h
              if res then
                  return Cons(h, takeWhileAsync predicate t)
              else return Nil }
  
      /// Returns elements from an asynchronous sequence while the specified 
      /// predicate holds. The predicate is evaluated synchronously.
      [<CompiledName("TakeWhile")>]
      let rec takeWhile predicate (input : AsyncSeq<'T>) : AsyncSeq<'T> =
          // Preconditions
          checkNonNull "input" input
  
          takeWhileAsync (predicate >> async.Return) input
  
      /// Skips the first N elements of an asynchronous sequence and
      /// then returns the rest of the sequence unmodified.
      [<CompiledName("Skip")>]
      let rec skip count (input : AsyncSeq<'T>) : AsyncSeq<'T> =
          // Preconditions
          checkNonNull "input" input
  
          async {
          if count > 0 then
              let! v = input
              match v with
              | Nil ->
                  return Nil
              | Cons(_, t) ->
                  return! skip (count - 1) t
          else return! input }
  
      /// Skips elements from an asynchronous sequence while the specified 
      /// predicate holds and then returns the rest of the sequence. The 
      /// predicate is evaluated asynchronously.
      [<CompiledName("SkipWhileAsync")>]
      let rec skipWhileAsync predicate (input : AsyncSeq<'T>) : AsyncSeq<'T> =
          // Preconditions
          checkNonNull "input" input
  
          async {
          let! v = input
          match v with
          | Nil ->
              return Nil
          | Cons (h, t) ->
              let! res = predicate h
              if res then return! skipWhileAsync predicate t
              else return! t }
  
      /// Skips elements from an asynchronous sequence while the specified 
      /// predicate holds and then returns the rest of the sequence. The 
      /// predicate is evaluated asynchronously.
      [<CompiledName("SkipWhile")>]
      let rec skipWhile predicate (input : AsyncSeq<'T>) : AsyncSeq<'T> =
          // Preconditions
          checkNonNull "input" input
  
          skipWhileAsync (predicate >> async.Return) input
  
  (*
  //
  
negative.code:     let singleton (value : 'T) : AsyncSeq<'T> =
          asyncSeq.Yield value
  
      /// Asynchronously returns the first element that was generated by the
      /// given asynchronous sequence (or the specified default value).
      [<CompiledName("FirstOrDefault")>]
      let firstOrDefault defaultValue (source : AsyncSeq<'T>) =
          // Preconditions
          checkNonNull "source" source
  
          async {
          let! v = source
          match v with
          | Nil ->
              return defaultValue
          | Cons (hd, _) ->
              return hd }
  
      /// Asynchronously returns the last element that was generated by the
      /// given asynchronous sequence (or the specified default value).
      [<CompiledName("LastOrDefault")>]
      let rec lastOrDefault defaultValue (source : AsyncSeq<'T>) =
          // Preconditions
          checkNonNull "source" source
  
          async {
          let! v = source
          match v with
          | Nil ->
              return defaultValue
          | Cons (hd, tl) ->
              return! lastOrDefault hd tl }
  
      /// Yields all elements of the first asynchronous sequence and then 
      /// all elements of the second asynchronous sequence.
      [<CompiledName("Append")>]
      let rec append (source1 : AsyncSeq<'T>) (source2 : AsyncSeq<'T>) : AsyncSeq<'T> =
          // Preconditions
          checkNonNull "source1" source1
          checkNonNull "source2" source2
  
          asyncSeq.Combine (source1, source2)
  
      /// Creates an asynchronous sequence that iterates over the given input sequence.
      /// For every input element, it calls the the specified function and iterates
      /// over all elements generated by that asynchronous sequence.
      /// This is the 'bind' operation of the computation expression (exposed using
      /// the 'for' keyword in asyncSeq computation).
      [<CompiledName("CollectAsync")>]
      let rec collectAsync mapping (source : AsyncSeq<'T>) : AsyncSeq<'U> =
          // Preconditions
          checkNonNull "source" source
  
          asyncSeq.For (source, mapping)
  
      // --------------------------------------------------------------------------
      // Additional combinators (implemented as async/asyncSeq computations)
  