Skip to content

Commit 2bbabdc

Browse files
[infra] Add list slice whatwg/infra@994009c
1 parent af5848d commit 2bbabdc

1 file changed

Lines changed: 72 additions & 33 deletions

File tree

infra-ja.html

Lines changed: 72 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@
123123

124124
●●options
125125

126-
spec_date:2026-04-10
127-
trans_update:2026-04-13
126+
spec_date:2026-04-14
127+
trans_update:2026-04-15
128128
source_checked:251124
129129
spec_status:LS
130130
original_url:https://infra.spec.whatwg.org/
@@ -314,7 +314,7 @@
314314
~list:#list
315315
~size:#list-size
316316
~item:#list-item
317-
~index群を取得する:#list-get-the-indices
317+
~index群:#list-get-the-indices
318318
存在-:#list-contain
319319
包含して:#list-contain
320320
~IN:#list-contain
@@ -328,6 +328,9 @@
328328
拡張する:#list-extend
329329
挿入する:#list-insert
330330
置換する:#list-replace
331+
~listから切出す:#list-slice
332+
%from:#list-slice-from
333+
%to:#list-slice-to
331334
~clone:#list-clone
332335
~cloneする:#list-clone
333336
逆順な~listを作成する:#list-reverse
@@ -483,6 +486,7 @@
483486
~call元:caller
484487
~call元~:calling
485488
続行-:proceed:~
489+
切出す:sliceする::切り出す
486490

487491
満たされる:evaluates to true
488492
渡され:passされ/
@@ -493,6 +497,7 @@
493497
js:JS
494498

495499
%L:list
500+
%~list:list
496501
%M:map
497502
%~map
498503
%入力:input
@@ -505,6 +510,7 @@
505510
%φ:φ
506511
%結果:result
507512
%結果:reversed
513+
%結果:slice
508514
%演算:operation
509515
%x:x
510516
%:example
@@ -1048,7 +1054,7 @@
10481054

10491055
Commits:
10501056
<a href="https://github.com/whatwg/infra/commits">GitHub whatwg/infra/commits</a>
1051-
<a href="https://infra.spec.whatwg.org/commit-snapshots/7f8c8ee40b9c24c3b154b23a674a361327e7a949/" id="commit-snapshot-link">Snapshot as of this commit</a>
1057+
<a href="https://infra.spec.whatwg.org/commit-snapshots/994009cded80e8e121be879ae8010225e4591b35/" id="commit-snapshot-link">Snapshot as of this commit</a>
10521058
<a href="https://twitter.com/infrastandard">@infrastandard</a>
10531059

10541060
Tests:
@@ -5985,7 +5991,7 @@ <h3 title="Lists">5.1. ~list</h3>
59855991
%~list の`~size$は、
59865992
アテガわれる変数の個数と同じでなければナラナイ。
59875993
各 %n ~IN { 1 〜 %~list の`~size$ } に対し,
5988-
%n 個目の変数は %~list[ %n 1 ] に設定される。
5994+
%n 個目の変数は %~list[ %n ~MINUS 1 ] に設定される。
59895995
59905996
For notational convenience, a multiple assignment syntax may be used to assign multiple variables to the list’s items, by surrounding the variables to be assigned by « » characters and separating each variable name with a comma. The list’s size must be the same as the number of variables to be assigned. Each variable given is then set to the value of the list’s item at the corresponding index.
59915997
</p>
@@ -6297,9 +6303,9 @@ <h3 title="Lists">5.1. ~list</h3>
62976303
A list is empty if its size is zero.
62986304
</li>
62996305
<li>
6300-
%L から
6301-
`~index群を取得する@
6302-
~algoは
6306+
%L
6307+
`~index群@
6308+
を取得する~algoは
63036309
63046310
~RET `範囲$ { 0 〜 %L の`~size$ − 1 }
63056311
@@ -6330,41 +6336,74 @@ <h3 title="Lists">5.1. ~list</h3>
63306336
のような句により,表記を簡約することもある。
63316337
</p>
63326338
</li>
6333-
<li>
6334-
<div class="p">
6339+
</ul>
6340+
6341+
<div class="algo">
63356342
<p>
6336-
%L を
6337-
`~cloneする@
6338-
~algoは:
6343+
`~listから切出す@
6344+
~algoは、
6345+
所与の
6346+
( `~list$ %L, 整数 %from ~DF 0, 整数 %to ~DF %L の`~size$ )
6347+
に対し:
6348+
6349+
To slice a list list, with an optional integer from (default 0) and an optional integer to (default list’s size), perform the following steps. They return a list of the same designation as list.
63396350
</p>
6340-
<ol>
6341-
<li>
6342-
%~clone ~LET %L と同じ型の【!of the same designation】新たな`~list$
6351+
<ol>
6352+
<li>
6353+
~Assert:
6354+
%from ~GTE 0
6355+
6356+
Assert: from is greater than or equal to 0.
6357+
</li>
6358+
<li>
6359+
~Assert:
6360+
%to ~LTE %L の`~size$
6361+
6362+
Assert: to is less than or equal to list’s size.
6363+
</li>
6364+
<li>
6365+
~Assert:
6366+
%from ~LTE %to
6367+
6368+
Assert: to is greater than or equal to from.
6369+
</li>
6370+
<li>
6371+
%結果 ~LET %L と同じ型の【!of the same designation】新たな`~list$
63436372
【すなわち、%L が`~stack$なら 新たな`~stack$,等々】
6373+
6374+
Let slice be a new list of the same designation as list.
63446375
</li>
6345-
<li>
6346-
%L を成す
6347-
`~EACH$( %~item )
6376+
<li>
6377+
`範囲$ { %from 〜 %to ~MINUS 1 } を成す
6378+
~EACH( %i )
63486379
に対し
63496380
6350-
%~clone に %~item を`付加する$
6381+
%結果 に %L[ %i ] を`付加する$
6382+
6383+
For each i of the range from to to, exclusive: append list[i] to slice.
63516384
</li>
6352-
<li>
6353-
~RET %~clone
6385+
<li>
6386+
~RET %結果
6387+
6388+
Return slice.
63546389
</li>
6355-
</ol>
6390+
</ol>
6391+
</div>
63566392

6393+
<div class="algo">
63576394
<p>
6358-
結果の %~clone は、
6359-
%L と同じ`~item$たちを同じ順序で`包含して$いることになる。
6360-
</p>
6395+
`~list$ %L を
6396+
`~cloneする@
6397+
~algoは
6398+
6399+
~RET `~listから切出す$( %L )
63616400
6362-
To clone a list list is to create a new list clone, of the same designation, and, for each item of list, append item to clone, so that clone contains the same items, in the same order as list.
6363-
</div>
6401+
To clone a list list is to return a slice of list.
6402+
</p>
63646403

63656404
<p class="note">注記:
6366-
`~item$自身は~cloneされないので、
6367-
これは “浅い~clone” である
6405+
これは “浅い~clone” である
6406+
— %L を成す各`~item$自体は~cloneされないので
63686407
63696408
This is a "shallow clone", as the items themselves are not cloned in any way.
63706409
</p>
@@ -6381,8 +6420,7 @@ <h3 title="Lists">5.1. ~list</h3>
63816420
63826421
Let original be the ordered set « "a", "b", "c" ». Cloning original creates a new ordered set clone, so that replacing "a" with "foo" in clone gives « "foo", "b", "c" », while original[0] is still the string "a".
63836422
</p>
6384-
</li>
6385-
</ul>
6423+
</div>
63866424

63876425
<div class="algo">
63886426
<p>
@@ -6394,7 +6432,8 @@ <h3 title="Lists">5.1. ~list</h3>
63946432
</p>
63956433
<ol>
63966434
<li>
6397-
%結果 ~LET 新たな`~list$
6435+
%結果 ~LET %L と同じ型の【!of the same designation】新たな`~list$
6436+
【すなわち、%L が`~stack$なら 新たな`~stack$,等々】
63986437
</li>
63996438
<li>
64006439
%L を成す

0 commit comments

Comments
 (0)