Wolfram Research

Function Repository Resource:


Source Notebook

Interruptibility map a function over a list while showing a progress indicator

Contributed by: Michael Sollami


maps function f over the given list dynamically, showing a temporary progress indicator.

Details and Options

DynamicMap dynamically displays updates on the progress of the map in a panel:
The panel displays the following details:
Item current index being processed
Size current size of resulting object
Time approximation of remaining time
If a computation is aborted, either by pressing the Abort button in the panel or by aborting the kernel normally, ResourceFunction["DynamicMap"] will return a list containing all the of work that was already finished.
Additionally, the index of the element ResourceFunction["DynamicMap"] was aborted on is reported.


Basic Examples

When we evaluate DynamicMap, a panel is generated that shows the progress of the mapping:

ResourceFunction["DynamicMap"][Pause[#] &, Range@10]

We can use DynamicMap to monitor a long computation and optionally abort it:

x = ResourceFunction["DynamicMap"][FactorInteger, Range[4^5, 8^7]];


Partial Results

Click the abort button in the panel to stop the computation, but return partially completed work:

ResourceFunction["DynamicMap"][Pause, Range[10]]

Resource History

License Information