Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Dで関数をメモ化するときに純粋さを維持する賢い方法はありますか?
RAM に保持されている大規模なデータセットの SHA1 計算をキャッシュするときに、これが必要です。
D が型システム内で表現できるのは、純粋関数を記憶する非純粋関数です。
概念的には、メモライザーも純粋ですが、型システムはそれを可能にするほど十分に表現力がありません。どこかでカンニングする必要があります。