From 32bd0170d69ed8145a0094c31452233186f0b650 Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Fri, 6 Sep 2024 12:04:25 -0600 Subject: [PATCH] fix spec text to yield undersized final chunk on exhaustion --- spec.emu | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec.emu b/spec.emu index 4d0f43c..4258857 100644 --- a/spec.emu +++ b/spec.emu @@ -21,7 +21,10 @@ copyright: false 1. Let _buffer_ be a new empty List. 1. Repeat, 1. Let _value_ be ? IteratorStepValue(_iterated_). - 1. If _value_ is ~done~, return ~unused~. + 1. If _value_ is ~done~, then + 1. If _buffer_ is not empty, then + 1. Perform Completion(Yield(CreateArrayFromList(_buffer_))). + 1. Return ~unused~. 1. Append _value_ to _buffer_. 1. If the number of elements in _buffer_ is ℝ(_chunkSize_), then 1. Let _completion_ be Completion(Yield(CreateArrayFromList(_buffer_))).