|
123 | 123 |
|
124 | 124 | ●●options |
125 | 125 |
|
126 | | -spec_date:2025-01-29 |
127 | | -trans_update:2025-01-29 |
| 126 | +spec_date:2025-05-19 |
| 127 | +trans_update:2025-07-16 |
128 | 128 | source_checked:230223 |
129 | 129 | spec_status:LS |
130 | 130 | original_url:https://infra.spec.whatwg.org/ |
|
364 | 364 | ~key群を取得する:#map-getting-the-keys |
365 | 365 | 値~群を取得する:#map-getting-the-values |
366 | 366 | ~entryを包含して:#map-exists |
367 | | - map.包含して:#map-exists |
368 | | - map.存在-:#map-exists |
369 | | - ~map内に存在する:#map-exists |
| 367 | + 存在-:#map-exists |
370 | 368 | ~entryの値を取得する:#map-get |
371 | | - map.取得する:#map-get |
| 369 | + ~DF:#map-with-default |
372 | 370 | ~entryの値を設定する:#map-set |
373 | | - map.設定する:#map-set |
374 | | -map.除去する:#map-remove |
375 | 371 | ~entryを除去する:#map-remove |
376 | 372 | map.~clearする:#map-clear |
377 | 373 | map.~cloneする:#map-clone |
|
1039 | 1035 |
|
1040 | 1036 | Commits: |
1041 | 1037 | <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> |
1043 | 1039 | <a href="https://twitter.com/infrastandard">@infrastandard</a> |
1044 | 1040 |
|
1045 | 1041 | Tests: |
@@ -7062,7 +7058,7 @@ <h3 title="Maps">5.2. ~map</h3> |
7062 | 7058 | <p class="example" id="example-map-notation"> |
7063 | 7059 | %M ~EQ `有順序~map$ «[ `a^l → `x^bl, `b^l → `y^bl ]» |
7064 | 7060 | が与えられた下では、 |
7065 | | -%M[`a^l] は `~byte列$ `x^bl を表す。 |
| 7061 | +%M[ `a^l ] の結果は `~byte列$ `x^bl になる。 |
7066 | 7062 | ◎ |
7067 | 7063 | Let example be the ordered map «[ "a" → `x`, "b" → `y` ]». Then example["a"] is the byte sequence `x`. |
7068 | 7064 | </p> |
@@ -7093,49 +7089,56 @@ <h3 title="Maps">5.2. ~map</h3> |
7093 | 7089 | `~entryの値を取得する@ |
7094 | 7090 | ~algoは、 |
7095 | 7091 | 所与の |
7096 | | -( %~key ) |
| 7092 | +( %~key, %既定 ~DF ε ) |
7097 | 7093 | に対し |
7098 | 7094 | ⇒ |
7099 | 7095 | ~RET %M は[ |
7100 | 7096 | `~key$map %~key を伴う`~entryを包含して$いる |
7101 | 7097 | ]ならば その`値$map / |
7102 | | -~ELSE_ ε |
| 7098 | +~ELSE_ %既定 |
7103 | 7099 | ◎ |
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. |
7105 | 7102 | • Assert: map contains key. |
7106 | 7103 | • Return the value of the entry in map whose key is key. |
7107 | 7104 | </p> |
7108 | 7105 |
|
7109 | 7106 | <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を包含して$いないことになる。 |
7120 | 7109 | 】</p> |
7121 | 7110 |
|
7122 | 7111 | <p> |
7123 | 7112 | `~entryの値を取得する$は、 |
7124 | 7113 | ~indexing構文でも表記できる |
7125 | 7114 | — 当の~mapの直後に角括弧で括られた`~key$mapを供することにより。 |
| 7115 | +既定の値 %既定 は、 |
| 7116 | +直後に |
| 7117 | +“<span id="map-with-default">~DF %既定</span>” |
| 7118 | +【原文では “`with default^en %既定” 】 |
| 7119 | +を記すことにより,与えれる。 |
7126 | 7120 | ◎ |
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. |
7128 | 7122 | </p> |
7129 | 7123 |
|
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> |
7136 | 7139 | ◎ |
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> |
7139 | 7142 | </li> |
7140 | 7143 | <li> |
7141 | 7144 | <p> |
|
0 commit comments