Skip to content

Commit 8c74b2a

Browse files
committed
Add set extend operation
"List extend" didn't really work since it used "list append", which doesn't properly handle duplicates.
1 parent 48531ec commit 8c74b2a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

infra.bs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1542,8 +1542,8 @@ list multiple assignment syntax is used.
15421542
<p>To <dfn export for=list>append</dfn> to a <a>list</a> that is not an <a>ordered set</a> is to
15431543
add the given <a for=list>item</a> to the end of the list.
15441544

1545-
<p>To <dfn export for=list>extend</dfn> a <a>list</a> |A| with a <a>list</a> |B|,
1546-
<a for=list>for each</a> |item| of |B|, <a for=list>append</a> |item| to |A|.
1545+
<p>To <dfn export for=list>extend</dfn> a <a>list</a> that is not an <a>ordered set</a> |A| with a
1546+
<a>list</a> |B|, <a for=list>for each</a> |item| of |B|, <a for=list>append</a> |item| to |A|.
15471547

15481548
<div class=example id=example-list-extend>
15491549
<ol>
@@ -1709,6 +1709,9 @@ ordered sets; implementations can optimize based on the fact that the order is n
17091709
the given <a for=set>item</a>, then do nothing; otherwise, perform the normal <a>list</a>
17101710
<a for=list>append</a> operation.
17111711

1712+
<p>To <dfn export for=set>extend</dfn> an [=ordered set=] |A| with a [=list=] |B|, [=list/for each=]
1713+
|item| of |B|, [=set/append=] |item| to |A|.
1714+
17121715
<p>To <dfn export for=set>prepend</dfn> to an <a>ordered set</a>: if the set
17131716
<a for=list>contains</a> the given <a for=set>item</a>, then do nothing; otherwise, perform the
17141717
normal <a>list</a> <a for=list>prepend</a> operation.

0 commit comments

Comments
 (0)