Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

BlockMap

BlockMap[f,list,n]
applies f to non-overlapping sublists of length n in list.

BlockMap[f,list,n,d]
applies f to sublists with offset d in list.

BlockMap[f,list,{n1,n2,},]
applies f to blocks of size n1×n2×.

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples  (4)Basic Examples  (4)

Apply a function to all non-overlapping, length-2 sublists:

In[1]:=
Click for copyable input
Out[1]=

Apply a function to overlapping sublists of length 2 with offset 1:

In[1]:=
Click for copyable input
Out[1]=

Apply a function to a matrix:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Apply a function to all 2x2 sub-matrices:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]//MatrixForm=
Introduced in 2015
(10.2)