Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Support constructing map from pairs #943
Transforming a map into a different one now requires mutating a map repeatedly. For example, to change all keys in a map to upper case:
If we have a function, say
For those wondering why this feature might be useful see the discussion about Elvish persistent data structures. In functional programming languages, such as Haskell, such data structures are central to the design of the language. They therefore use very sophisticated solutions to the problem of cheaply mutating otherwise immutable lists or maps. Elvish currently uses the simplest, and typically least performant, solution for that problem: copy on write. See https://en.wikipedia.org/wiki/Persistent_data_structure.
Note that the
in the first example in the problem description actually creates a new map and binds it to the