anchor.diff:                                         fn=Fun,
                                          max_concurrent=MaxP},
                                List),
  -    % Collect pending work
  -    Collect =
  -        fun(Pid, Acc) ->
  -                receive
  -                    {pmap_result, Pid, R} ->
  -                        [R|Acc]
  -                end
  -        end,
  -    All = lists:foldl(Collect, Done, Pending),
  +    All = pmap_collect_rest(Pending, Done),
       % Restore input order
       Sorted = lists:keysort(1, All),
       [ R || {_, R} <- Sorted ].
  
positive.code:                                 n_done=ND+1, done=[Result|Done]}).
  
  %% @doc Waits for one pending pmap task to finish
  pmap_collect_one(Pending = [_First|_More]) ->
      receive
          {pmap_result, Pid, Result} ->
              case lists:member(Pid, Pending) of
                  true ->
                      {Result, lists:delete(Pid, Pending)};
                  false ->
                      pmap_collect_one(Pending)
              end
      end.
  
  
  
negative.code:                   mapper,
                    fn,
                    n_pending=0,
                    pending=sets:new(),
                    n_done=0,
                    done=[],
                    max_concurrent=1
  