Updating nested immutable data structures

后端 未结 5 1869
长情又很酷
长情又很酷 2020-12-14 02:39

I want to update a nested, immutable data structure (I attached a small example of a hypothetical game.) And I wonder whether this can be done a little more elegantly.

5条回答
  •  一生所求
    2020-12-14 03:31

    I posted a similar question about Scala about a year back. The answers mention three concepts as a solution to this problem: Zippers, Tree rewriting, and Lenses.

提交回复
热议问题