# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Delete an element from the value of a symbol and reset the symbol to the result

Contributed by:
Ian Ford

ResourceFunction["DeleteFrom"][ deletes the element at position | |

ResourceFunction["DeleteFrom"][ deletes the part at position { | |

ResourceFunction["DeleteFrom"][ deletes parts at several positions. |

ResourceFunction["DeleteFrom"][*x*,*pos*] is equivalent to *x*=Delete[*x*,*pos*].

ResourceFunction["DeleteFrom"] has attribute HoldFirst.

Deleting the head of a particular element from *x* sets it equal to the result of applying FlattenAt to the value of *x* at that point.

Deleting the head from *x* makes the head be Sequence.

ResourceFunction["DeleteFrom"] works on SparseArray objects.

ResourceFunction["DeleteFrom"] works on associations, removing elements with the specified keys and returning them.

Assign *x* to a list:

In[1]:= |

Out[1]= |

Delete the element at position 3 from the list:

In[2]:= |

Out[2]= |

The value assigned to *x* has changed:

In[3]:= |

Out[3]= |

Delete at position 2 from the end:

In[4]:= |

Out[4]= |

Delete at positions 1 and 3:

In[5]:= |

Out[5]= |

Delete from a 2D array:

In[6]:= |

Out[6]= |

In[7]:= |

Out[7]= |

Delete from an Association:

In[8]:= |

Out[8]= |

In[9]:= |

Out[9]= |

In[10]:= |

Out[10]= |

DeleteFrom works on sparse arrays:

In[11]:= |

Out[11]= |

In[12]:= |

Out[12]= |

Deleting the head makes the head be Sequence:

In[13]:= |

Out[13]= |

In[14]:= |

Out[14]= |

Deleting at an empty list of positions does not change the value:

In[15]:= |

Out[15]= |

In[16]:= |

Out[16]= |

Deleting at position {} deletes the whole expression:

In[17]:= |

Out[17]= |

In[18]:= |

Out[18]= |

Wolfram Language 11.3 (March 2018) or above

- 1.0.0 – 17 December 2018

This work is licensed under a Creative Commons Attribution 4.0 International License