1651 ordered maps#1703
Merged
Merged
Conversation
Contributor
ChristianGruen
left a comment
There was a problem hiding this comment.
I like the proposal, including the definition of “entry order”, and I appreciate the effort made to incorporate all the changes.
| and returns the sequence concenation of the results.</p> | ||
| <p>The <code>dm:iterate-map</code> accessor calls the supplied <code>$action</code> | ||
| function once for each key/value pair in <code>$map</code>, | ||
| and returns the sequence concenation of the results. The order in which entries |
Contributor
There was a problem hiding this comment.
Suggested change
| and returns the sequence concenation of the results. The order in which entries | |
| and returns the sequence concatenation of the results. The order in which entries |
| <!--<fos:option key="retain-order"> | ||
| <fos:meaning>Determines the | ||
| <xtermref spec="DM40" ref="dt-entry-order">entry order</xtermref> of the | ||
| entries in the returned map, as well as the value of the map's |
Contributor
There was a problem hiding this comment.
Suggested change
| entries in the returned map, as well as the value of the map's | |
| entries in the returned map, as well as the value of the map’s |
| }) | ||
| } | ||
| return fold-left($maps, {}, | ||
| return fold-left($maps, dm:empty-map($options?ordering otherwise "undefined"), |
Contributor
There was a problem hiding this comment.
Suggested change
| return fold-left($maps, dm:empty-map($options?ordering otherwise "undefined"), | |
| return fold-left($maps, {}, |
| </fos:test> | ||
|
|
||
| <fos:test> | ||
| <fos:expression><eg>map:merge(({ "red": 0 }, { "green": 1}, { "blue": 2 }), |
Contributor
There was a problem hiding this comment.
Suggested change
| <fos:expression><eg>map:merge(({ "red": 0 }, { "green": 1}, { "blue": 2 }), | |
| <fos:expression><eg>map:merge(({ "red": 0 }, { "green": 1}, { "blue": 2 })) |
|
|
||
| <fos:test> | ||
| <fos:expression><eg>map:merge(({ "red": 0 }, { "green": 1}, { "blue": 2 }), | ||
| { "retain-order": true() } => map:keys()</eg></fos:expression> |
Contributor
There was a problem hiding this comment.
Suggested change
| { "retain-order": true() } => map:keys()</eg></fos:expression> | |
| => map:keys()</eg></fos:expression> |
| while the call <code>cx:complex(3)</code> produces the value <code>{ "r": 3e0, "i": 0e0 }</code></p> | ||
|
|
||
| <p>The resulting map has its <xtermref spec="DM40" ref="dt-map-ordered"/> property set to | ||
| <code>true</code>, so the order of entries corresponds |
Contributor
There was a problem hiding this comment.
Suggested change
| <code>true</code>, so the order of entries corresponds | |
| <p>The order of entries corresponds |
| { "r": $r }, | ||
| if (exists($i)) { { "i": $i } } | ||
| )) | ||
| ), { "retain-order" : true() }) |
Contributor
There was a problem hiding this comment.
Suggested change
| ), { "retain-order" : true() }) | |
| )) |
| $options | ||
| ), | ||
| { "duplicates": "use-first" } | ||
| { "duplicates": "use-first", "retain-order" : true() } |
Contributor
There was a problem hiding this comment.
Suggested change
| { "duplicates": "use-first", "retain-order" : true() } | |
| { "duplicates": "use-first" } |
| <p>The effect of the <code>duplicates</code> option here is that when two values are supplied for the same field, | ||
| one as a direct argument in the function call and the other in the <code>options</code> map, the value supplied | ||
| as a direct argument is used in preference.</p> | ||
| as a direct argument is used in preference. The effect of the <code>ordering</code> option is that the resulting |
Contributor
There was a problem hiding this comment.
Suggested change
| as a direct argument is used in preference. The effect of the <code>ordering</code> option is that the resulting | |
| as a direct argument is used in preference. The resulting |
| <item><p>The second argument in the call of the function <code>map:merge</code> | ||
| is the map <code>{ "duplicates": "use-first" }</code>. This can be omitted if the record is not | ||
| extensible, because in this case duplicate field names cannot arise.</p></item> | ||
| is the map <code>{ "duplicates": "use-first", "retain-order": true() }</code>.</p></item> |
Contributor
There was a problem hiding this comment.
Suggested change
| is the map <code>{ "duplicates": "use-first", "retain-order": true() }</code>.</p></item> | |
| is the map <code>{ "duplicates": "use-first" }</code>.</p></item> |
61fc171 to
4301c54
Compare
Contributor
Author
|
I have applied all the copy-edits suggested by Christian. |
Contributor
|
…looks all good! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reopened pull request introducing ordered maps.
Fix #1651.