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
Identity return the list of all values Flatten return the flattened list of all values Merge[f] merge associations using the function f
Examples
open allclose allBasic 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:
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:
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:
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