From 1388e5c78195ffb10e20a9100a5e7813595cb1a8 Mon Sep 17 00:00:00 2001 From: Tab Atkins-Bittner Date: Thu, 5 May 2022 11:41:38 -0700 Subject: [PATCH] Precisely specify iteration details. Fixes #396 --- infra.bs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/infra.bs b/infra.bs index a5662fd..bb39d89 100644 --- a/infra.bs +++ b/infra.bs @@ -1389,6 +1389,7 @@ its size is zero. set of steps on each item in order, use phrasing of the form "For each |item| of list", and then operate on |item| in the subsequent prose. +The subsequent prose constitutes the |steps| of [=sequence iteration=] over the [=list=].

To clone a list |list| is to create a new list |clone|, of the same designation, and, for each |item| of |list|, @@ -1424,6 +1425,23 @@ ascending order, with |a| being less than |b| if |a|'s second item code unit less than |b|'s second item, gives the result « (404, "Not Found"), (200, "OK"), (null, "OK") ».

+
+ Sequence iteration over an ordered sequence |seq|, + given some per-item |steps|, + means to: + + 1. Let |length| be the number of entries in |seq|. + 1. Let |index| initially be 0. + 1. While |index| < |length|: + 1. Let |entry| be the |index|th entry in |seq|. + 1. Invoke |steps| with |entry|. + 1. Increment |index| by 1. + 1. Set |length| to the number of entries in |seq|. + + Note: Both the number of entries in |seq|, and their order, + can potentialy change while invoking |steps|. +
+

The list type originates from the JavaScript specification (where it is capitalized, as @@ -1595,6 +1613,7 @@ of running get the keys on the map. a set of steps on each entry in order, use phrasing of the form "For each |key| → |value| of |map|", and then operate on |key| and |value| in the subsequent prose. +The subsequent prose constitutes the |steps| of [=sequence iteration=] over the [=map=].

To clone an ordered map |map| is to create a new ordered map |clone|, and, for each |key| → |value| of |map|,