Skip to main content

Dictionary.fold_with_key

fold_with_keyinitfunction

Documentation

Combines the key-value pairs in the dictionary.

Arguments

  • init: The initial value for the fold.
  • function: A function taking the left value, the current key, and the current value, and combining them to yield a single value.

Examples

Glue the values in the dictionary together with the keys.

      import Standard.Examples

example_fold_with_key =
Examples.dictionary.fold_with_key "" (l -> k -> v -> l + k.to_text + v)