spmallette opened a new pull request, #3554:
URL: https://github.com/apache/tinkerpop/pull/3554

   The Fold Step section of the reference documentation annotated the example 
`g.inject(["a":1],["b":2]).fold([], addAll)` as "a mechanism for merging `Map` 
instances" where a later key occurrence replaces an earlier one. That 
description does not match what the line does. With a list seed (`[]`), 
`addAll` collects the incoming maps into a list, producing `[[a:1],[b:2]]` with 
no merging and no key replacement. The described last-writer-wins merge only 
happens with a map seed.
   
   This change:
   
   - Keeps the existing list-seed example, which is correct and useful.
   - Rewrites its callout to describe the actual list-seed behavior (collect 
the maps into a list, `[[a:1],[b:2]]`, no merge).
   - Adds a companion map-seed example, `g.inject(["a":1],["b":2]).fold([:], 
addAll)`, with a callout describing the real `putAll` merge (`[a:1,b:2]`, last 
occurrence wins).
   - Makes the seed-type dependence of `addAll` explicit: a list seed collects 
elements into a list, while a map seed merges the maps.
   
   Both examples are executed at doc-build time. The rendered outputs confirm 
the documented results: the list seed yields `[[a:1],[b:2]]` and the map seed 
yields `[a:1,b:2]`. Callouts 1-6 and unrelated content are unchanged.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to