--- a/SequenceableCollection.st Sun Feb 23 14:21:06 2020 +0100
+++ b/SequenceableCollection.st Sun Feb 23 15:45:01 2020 +0100
@@ -3311,6 +3311,25 @@
"
!
+copyButFirstAndLast
+ "return a new collection consisting of the receiver's elements
+ except for the first and last elements.
+ Raises an error if the receiver's size is less than 2."
+
+ |sz|
+
+ (sz := self size) < 2 ifTrue:[self notEnoughElementsError].
+ ^ self copyFrom:2 to:(sz - 1)
+
+ "
+ #($a $b $c $d $e $f $g) copyButFirstAndLast
+ '1234567890' copyButFirstAndLast
+ '1' copyButFirstAndLast
+ '' copyButFirstAndLast
+ 'ab' copyButFirstAndLast
+ "
+!
+
copyButLast
"return a new collection consisting of the receiver's elements
except for the last element.