Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Divide a Map operation into batches, performing an evaluation between batches
applies f to each element on the first level of expr,pausing for one second every five elements.
applies f to each element on the first level of expr,performing action every five elements.
uses batches of length n.
MapBatched applies a function to a list or association. By default, batches consist of 5 entries, and the action taken is to Pause for one second per batch:
When the number of elements is less than the batch size, no Pause is inserted:
The expr can be any expression over which the function f can be mapped (e.g., lists and associations). The action can be any expression:
The size n can be any integer:
One intended usage is to access web APIs that restrict request rates. For example, manual access to PubChem via the PUG API:
Define a list of chemicals:
Retrieve results from the API in batches:
This work is licensed under a Creative Commons Attribution 4.0 International License