MergingFunction

MergingFunction

is an option for functions such as PersistentSymbol that specifies a function to apply to the list of values found.

Details

  • Some common settings for MergingFunction include:
  • First
  • return only the first value
  • Identityreturn the list of all values
    Flattenreturn the flattened list of all values
    Merge[f]merge associations using the function f

Examples

open allclose all

Basic Examples  (2)

Create a number of persistent values with key "pval" at different persistence locations:

Give all values that exist on $PersistencePath:

Give only the first value found:

Create a number of persistent values with key "lval" at different persistence locations:

Give the list of all values found:

Join the list values:

Flatten all sublists:

Scope  (3)

Create a complement of persistent values with key "lval" at various locations:

List all existing values for the key "lval" on $PersistencePath:

By default, only the first value is returned:

Join and flatten all sublists:

Join all sublists:

Create a complement of persistent associations with name "aval" at various locations:

List all existing values on $PersistencePath:

Merge the values of identical keys in the associations:

Define a default value for "mylist" with a custom merging function:

Define additional values at different persistence locations:

For looking up values, the custom merging function is now used:

Wolfram Research (2017), MergingFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/MergingFunction.html.

Text

Wolfram Research (2017), MergingFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/MergingFunction.html.

CMS

Wolfram Language. 2017. "MergingFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MergingFunction.html.

APA

Wolfram Language. (2017). MergingFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MergingFunction.html

BibTeX

@misc{reference.wolfram_2024_mergingfunction, author="Wolfram Research", title="{MergingFunction}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/MergingFunction.html}", note=[Accessed: 18-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_mergingfunction, organization={Wolfram Research}, title={MergingFunction}, year={2017}, url={https://reference.wolfram.com/language/ref/MergingFunction.html}, note=[Accessed: 18-November-2024 ]}