From 8fa257c463be4c345f1acfb9bc61ec27e2798db2 Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Tue, 13 May 2025 11:42:32 -0600 Subject: [PATCH 1/3] throw when `windows` cannot yield at least 1 window --- spec.emu | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec.emu b/spec.emu index 86c45b8..6980487 100644 --- a/spec.emu +++ b/spec.emu @@ -48,7 +48,9 @@ copyright: false 1. Let _buffer_ be a new empty List. 1. Repeat, 1. Let _value_ be ? IteratorStepValue(_iterated_). - 1. If _value_ is ~done~, return ReturnCompletion(*undefined*). + 1. If _value_ is ~done~, then + 1. If the number of elements in _buffer_ < ℝ(_windowSize_), throw a *TypeError* exception. + 1. Else, return ReturnCompletion(*undefined*). 1. Append _value_ to _buffer_. 1. If the number of elements in _buffer_ is ℝ(_windowSize_), then 1. Let _completion_ be Completion(Yield(CreateArrayFromList(_buffer_))). From f3602306eb67fd2b05dcfb480ce43a6cfcd0e2bf Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Tue, 13 May 2025 12:57:08 -0600 Subject: [PATCH 2/3] Update spec.emu Co-authored-by: Kevin Gibbons --- spec.emu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec.emu b/spec.emu index 6980487..4ec85e7 100644 --- a/spec.emu +++ b/spec.emu @@ -50,7 +50,7 @@ copyright: false 1. Let _value_ be ? IteratorStepValue(_iterated_). 1. If _value_ is ~done~, then 1. If the number of elements in _buffer_ < ℝ(_windowSize_), throw a *TypeError* exception. - 1. Else, return ReturnCompletion(*undefined*). + 1. Return ReturnCompletion(*undefined*). 1. Append _value_ to _buffer_. 1. If the number of elements in _buffer_ is ℝ(_windowSize_), then 1. Let _completion_ be Completion(Yield(CreateArrayFromList(_buffer_))). From 95bbdb8f735aedcbfe9eece4c0bd7a6cd3fe12ad Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Tue, 13 May 2025 14:34:22 -0600 Subject: [PATCH 3/3] Update spec.emu Co-authored-by: Kevin Gibbons --- spec.emu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec.emu b/spec.emu index 4ec85e7..7352234 100644 --- a/spec.emu +++ b/spec.emu @@ -49,7 +49,7 @@ copyright: false 1. Repeat, 1. Let _value_ be ? IteratorStepValue(_iterated_). 1. If _value_ is ~done~, then - 1. If the number of elements in _buffer_ < ℝ(_windowSize_), throw a *TypeError* exception. + 1. If _buffer_ is not empty and the number of elements in _buffer_ < ℝ(_windowSize_), throw a *TypeError* exception. 1. Return ReturnCompletion(*undefined*). 1. Append _value_ to _buffer_. 1. If the number of elements in _buffer_ is ℝ(_windowSize_), then