Skip to main content

Dictionary.transform

transformfunction

Documentation

Transforms the map's keys and values to create a new dictionary.

Arguments

  • function: The function used to transform the dictionary, taking a key and a value and returning a pair of [key, value].

Examples

Turn all keys into Text and append "_word" to the values in the

dictionary.

      import Standard.Examples

example_transform =
Examples.dictionary.transform (k -> v -> [k.to_text, v + "_word"])

Errors

  • If multiple dictionary entries end up with duplicate keys after the transformation, an Illegal_Argument.Error is thrown.