I have an algorithm enumerating certain expressions (nested lists of integers) and I need to maintain a set of already visited expressions. I only need to add expressions to the set, never remove them or backtrack. I can implement it either using `DownValues` or `Association`. E.g. `Module[{visited}, ...
If[!TrueQ[visited[expr]], visited[expr] = True; ...] ...]` or `Module[{visited=<||>}, ...
If[!TrueQ[visited[expr]], visited[expr] = True; ...] ...]`. What are pros and cons of each approach? Which is faster, and which does consume more memory?
If[!TrueQ[visited[expr]], visited[expr] = True; ...] ...]` or `Module[{visited=<||>}, ...
If[!TrueQ[visited[expr]], visited[expr] = True; ...] ...]`. What are pros and cons of each approach? Which is faster, and which does consume more memory?