chomp: Remove the head and tail of a data structure
Description
Remove the specified number of elements from either the
head or tail of a data structure.
Arguments
x
Any indexable data structure
head
The number of elements to be removed from the
head of x
tail
The number of elements to be removed from the
tail of x
Value
A data structure with the head and tail chomped off
Usage
chomp(x, head=1, tail=1)
Details
This function is inspired by the PERL function of the
same name. While the PERL version is designed for
strings, this version is designed for any indexable data
structure, typically containing numbers.