You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
6339
6350
</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$
6343
6372
【すなわち、%L が`~stack$なら 新たな`~stack$,等々】
6373
+
◎
6374
+
Let slice be a new list of the same designation as list.
6344
6375
</li>
6345
-
<li>
6346
-
%L を成す
6347
-
`~EACH$( %~item )
6376
+
<li>
6377
+
`範囲$ { %from 〜 %to ~MINUS 1 } を成す
6378
+
~EACH( %i )
6348
6379
に対し
6349
6380
⇒
6350
-
%~clone に %~item を`付加する$
6381
+
%結果 に %L[ %i ] を`付加する$
6382
+
◎
6383
+
For each i of the range from to to, exclusive: append list[i] to slice.
6351
6384
</li>
6352
-
<li>
6353
-
~RET %~clone
6385
+
<li>
6386
+
~RET %結果
6387
+
◎
6388
+
Return slice.
6354
6389
</li>
6355
-
</ol>
6390
+
</ol>
6391
+
</div>
6356
6392
6393
+
<divclass="algo">
6357
6394
<p>
6358
-
結果の %~clone は、
6359
-
%L と同じ`~item$たちを同じ順序で`包含して$いることになる。
6360
-
</p>
6395
+
`~list$ %L を
6396
+
`~cloneする@
6397
+
~algoは
6398
+
⇒
6399
+
~RET `~listから切出す$( %L )
6361
6400
◎
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>
6364
6403
6365
6404
<pclass="note">注記:
6366
-
`~item$自身は~cloneされないので、
6367
-
これは “浅い~clone” である。
6405
+
これは “浅い~clone” である
6406
+
— %L を成す各`~item$自体は~cloneされないので。
6368
6407
◎
6369
6408
This is a "shallow clone", as the items themselves are not cloned in any way.
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".
0 commit comments