907770: Asynchronous map for Tornado's ioloop
Added 6 years ago by Petri Lehtinen
An asynchronous implementation of the map function.
Takes a mapping function, an iterable and a callback. Calls the mapping function for all items of iterable, saves the result to a list, and calls callback with that list.
The mapping function should have the signature
fn(data, callback). When it's done, it should call
callback with a single argument.
The mapping function is called sequentially, i.e. only one "instance" of the mapping function is run at a time. It's also guaranteed that order of results corresponds to the order of the items of the iterable.
This is most useful when the mapping function works asynchronously.