Skip to content

change function for map does not appear to work correctly #105

Closed
@jaycunningham-8451

Description

@jaycunningham-8451

Describe the bug
This may not be a bug, but I can't find documentation for the change function / method as it applies to maps. It certainly does not appear to operate in a way that I would expect.

Calling change on an existing, nonempty map appears to operate as if it were called on an empty map.

To Reproduce

This results in a Nothing_ error, when I would expect it to return the map unchanged:

from expression.collections import Map

xs = Map.of(**dict(a=10, b=20))
xs.change("a", lambda x: x)

This results in map [("a", 1)] when I would expect map [("a", 1); ("b", 20)]:

xs.change("a", lambda _: Some(1))

Expected behavior
As indicated above, I would expect that the first block would return the map unchanged, and that the second would only modify the item with the key "a".

Additional context
Add any other context about the problem here.

  • OS MacOS 13
  • Expression version 4.2.2
  • Python version 3.11.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions