Filter: keep only the last length items.

assert [1,2,3,4,5].iterator.tail(2).to_a         ==  [4,5]

Important: require O(length) in memory

Property definitions

pipeline :: pipeline $ Iterator :: tail
	# Filter: keep only the last `length` items.
	#
	#     assert [1,2,3,4,5].iterator.tail(2).to_a	     ==  [4,5]
	#
	# Important: require O(length) in memory
	fun tail(length: Int): Iterator[E]
	do
		var lasts = new List[E]
		while self.is_ok do
			while lasts.length >= length do lasts.shift
			lasts.push(self.item)
			self.next
		end
		return lasts.iterator
	end
lib/pipeline/pipeline.nit:125,2--139,4