Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add set extend operation #663

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions infra.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1542,8 +1542,8 @@ list multiple assignment syntax is used.
<p>To <dfn export for=list>append</dfn> to a <a>list</a> that is not an <a>ordered set</a> is to
add the given <a for=list>item</a> to the end of the list.

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

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

<p>To <dfn export for=set>extend</dfn> an [=ordered set=] |A| with a [=list=] |B|, [=list/for each=]
|item| of |B|, [=set/append=] |item| to |A|.

<p>To <dfn export for=set>prepend</dfn> to an <a>ordered set</a>: if the set
<a for=list>contains</a> the given <a for=set>item</a>, then do nothing; otherwise, perform the
normal <a>list</a> <a for=list>prepend</a> operation.
Expand Down