Wolfram Research

DynamicMap

Contributed by: Michael Sollami

Source Notebook

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

ResourceFunction["DynamicMap"][f,list]

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, any unfinished computation will be returned as $Aborted.
Additionally, the index of the element DynamicMap was aborted on is reported.

Examples

Basic Examples

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

In[1]:=
ResourceFunction["DynamicMap"][Pause[#] &, Range@10]
Out[1]=

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

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

Scope

Partial Results

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

In[3]:=
ResourceFunction["DynamicMap"][Pause, Range[10]]
Out[3]=

Resource History