umajho / dicexp

Dicexp 是一种表示掷骰的表达式。本仓库代码用于对该表达式求值,并作为该表达式的事实标准。
https://umajho.github.io/dicexp/
MIT License
2 stars 0 forks source link

基于字典的记忆化机制 #16

Open umajho opened 1 year ago

umajho commented 1 year ago

靠着 LazyValue 记忆求值结果,并且到处传入 reevaluate 有些难以跟上。 目前的想法是改成用 Map<Node, Concrete | false> 记忆针对 Node 的 interpret 结果。false 代表对应 Node 求值的结果多变,因此不会记忆曾经的求值结果。

umajho commented 1 year ago

上面设想的机制不能替代原先的记忆化机制。后者已从其他方面进行重构(https://github.com/umajho/dicexp/commit/039fa7a1123af072d51ed1e0254e233134ec2a59)。

未来可以考虑用上面的机制记录字面量的求值结果,但优先度不是很高。