Function Repository Resource:

# CopyMachine

Create an operator for copying expressions

Contributed by: Bob Sandheinrich
 ResourceFunction["CopyMachine"][n][expr] creates a list of n copies of expr. ResourceFunction["CopyMachine"][n,h][expr] wraps n copies of expr in h. ResourceFunction["CopyMachine"][{n1,n2,…},…][expr] creates an n1⨯n2⨯… array. ResourceFunction["CopyMachine"][…] represents a copy machine.

## Details

ResourceFunction["CopyMachine"] is an operator that is commonly used in Dataset and Query.

## Examples

### Basic Examples (3)

Create an operator for making ten copies:

 In[1]:=
 Out[1]=

Make ten copies:

 In[2]:=
 Out[2]=

Create an operator that creates copies within a string:

 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=

Create a 3×2 array using an operator:

 In[5]:=
 Out[5]=
 In[6]:=
 Out[6]=

### Scope (2)

Import a dataset:

 In[7]:=
 Out[7]=

Create a dataset that only contains five copies of the last row:

 In[8]:=
 Out[8]=

Copy the fourth row three times:

 In[9]:=
 Out[9]=

Create random data in a list:

 In[10]:=
 Out[10]=

Splice five copies of the second element into the data:

 In[11]:=
 Out[11]=

### Applications (1)

Give Honest Abe a vocal quirk:

 In[12]:=
 Out[12]=

### Properties and Relations (3)

For arrays, the head h is used at all levels:

 In[13]:=
 Out[13]=

Using zero gives an empty result:

 In[14]:=
 Out[14]=

Negative repetitions are not supported:

 In[15]:=
 Out[15]=

Bob

## Version History

• 1.0.0 – 15 March 2022

## Author Notes

The motivation for creating CopyMachine was to be able to splice into structures like datasets.