Skip to content

Commit 4f9008b

Browse files
[infra] Get a map value with a default whatwg/infra@d86cb0e
1 parent a0b47a0 commit 4f9008b

1 file changed

Lines changed: 35 additions & 32 deletions

File tree

infra-ja.html

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

124124
●●options
125125

126-
spec_date:2025-01-29
127-
trans_update:2025-01-29
126+
spec_date:2025-05-19
127+
trans_update:2025-07-16
128128
source_checked:230223
129129
spec_status:LS
130130
original_url:https://infra.spec.whatwg.org/
@@ -364,14 +364,10 @@
364364
~key群を取得する:#map-getting-the-keys
365365
~群を取得する:#map-getting-the-values
366366
~entryを包含して:#map-exists
367-
map.包含して:#map-exists
368-
map.存在-:#map-exists
369-
~map内に存在する:#map-exists
367+
存在-:#map-exists
370368
~entryの値を取得する:#map-get
371-
map.取得する:#map-get
369+
~DF:#map-with-default
372370
~entryの値を設定する:#map-set
373-
map.設定する:#map-set
374-
map.除去する:#map-remove
375371
~entryを除去する:#map-remove
376372
map.~clearする:#map-clear
377373
map.~cloneする:#map-clone
@@ -1039,7 +1035,7 @@
10391035

10401036
Commits:
10411037
<a href="https://github.com/whatwg/infra/commits">GitHub whatwg/infra/commits</a>
1042-
<a href="https://infra.spec.whatwg.org/commit-snapshots/8c74b2ac77ba602b36d79034229be465b972d17b/" id="commit-snapshot-link">Snapshot as of this commit</a>
1038+
<a href="https://infra.spec.whatwg.org/commit-snapshots/d86cb0e0e7d27441549d1216963c714fae67bc14/" id="commit-snapshot-link">Snapshot as of this commit</a>
10431039
<a href="https://twitter.com/infrastandard">@infrastandard</a>
10441040

10451041
Tests:
@@ -7062,7 +7058,7 @@ <h3 title="Maps">5.2. ~map</h3>
70627058
<p class="example" id="example-map-notation">
70637059
%M ~EQ `有順序~map$ «[ `a^l → `x^bl, `b^l → `y^bl ]»
70647060
が与えられた下では、
7065-
%M[`a^l] は `~byte列$ `x^bl を表す
7061+
%M[ `a^l ] の結果は `~byte列$ `x^bl になる
70667062
70677063
Let example be the ordered map «[ "a" → `x`, "b" → `y` ]». Then example["a"] is the byte sequence `x`.
70687064
</p>
@@ -7093,49 +7089,56 @@ <h3 title="Maps">5.2. ~map</h3>
70937089
`~entryの値を取得する@
70947090
~algoは、
70957091
所与の
7096-
( %~key )
7092+
( %~key, %既定 ~DF ε )
70977093
に対し
70987094
70997095
~RET %M は[
71007096
`~key$map %~key を伴う`~entryを包含して$いる
71017097
]ならば その`値$map /
7102-
~ELSE_ ε
7098+
~ELSE_ %既定
71037099
7104-
To get the value of an entry in an ordered map map given a key key:
7100+
To get the value of an entry in an ordered map map given a key key and an optional default:
7101+
• If map does not contain key and default is given, then return default.
71057102
• Assert: map contains key.
71067103
• Return the value of the entry in map whose key is key.
71077104
</p>
71087105

71097106
<p class="trans-note">
7110-
原文では、
7111-
表明を通して[
7112-
%M が該当する`~entryを包含して$いない場合
7113-
]には,この~algoは利用し得ないものと定義されているが
7114-
(すなわち、
7115-
この演算を利用する前に,該当する`~entryを包含して$いることを確保する必要がある)、
7116-
和訳では,これに意図的に従わず、
7117-
ε を返すものと定義を改める
7118-
— したがって、
7119-
`~entry$の`値$mapは ε をとり得ないことになる。
7107+
`~entry$の`値$mapが ε をとることは,決してないので、
7108+
結果が ε ならば %M は該当する`~entryを包含して$いないことになる。
71207109
</p>
71217110

71227111
<p>
71237112
`~entryの値を取得する$は、
71247113
~indexing構文でも表記できる
71257114
— 当の~mapの直後に角括弧で括られた`~key$mapを供することにより。
7115+
既定の値 %既定 は、
7116+
直後に
7117+
<span id="map-with-default">~DF %既定</span>
7118+
【原文では “`with default^en %既定” 】
7119+
を記すことにより,与えれる。
71267120
7127-
We can also denote getting the value of an entry using an indexing syntax, by providing a key inside square brackets directly following a map.
7121+
We can also denote getting the value of an entry using an indexing syntax, by providing a key inside square brackets directly following a map. A default can be given by adding the phrase with default followed by the default value.
71287122
</p>
71297123

7130-
<p class="example">
7131-
~IF[
7132-
%M[ `test^l ] ~NEQ ε
7133-
7134-
7135-
~RET %M[ `test^l ]
7124+
<div class="example">
7125+
<p>
7126+
%M として «[ `a^l → `x^l, `b^l → `y^l ]» が与えられたなら:
7127+
<p>
7128+
<ul>
7129+
<li>
7130+
%M[ `a^l ] の結果は `x^l になる。
7131+
</li>
7132+
<li>
7133+
%M[ `a^l ] ~DF `z^l の結果も `x^l になる。
7134+
</li>
7135+
<li>
7136+
%M[ `c^l ] ~DF `z^l の結果は `z^l になる。
7137+
</li>
7138+
</ul>
71367139
7137-
If map["test"] exists, then return map["test"].
7138-
</p>
7140+
Let example be the ordered map «[ "a" → "x", "b" → "y" ]». Then example["a"] is the same as example["a"] with default "z", namely "x". example["c"] would hit an assert. example["c"] with default "z" is "z".
7141+
</div>
71397142
</li>
71407143
<li>
71417144
<p>

0 commit comments

Comments
 (0)