robrix / Hammer

Parsing and pattern matching in Objective-C
BSD 3-Clause "New" or "Revised" License
75 stars 1 forks source link

Implement hashing recursively. #76

Closed robrix closed 10 years ago

robrix commented 10 years ago

This would be a really great use case for a fixpoint.

robrix commented 10 years ago

Have to be careful to ensure that the hash function is monotonic or else it will recurse infinitely—i.e. alternation couldn’t hash as left.hash ^ right.hash because left or right could be self, and xor is not commutative, and therefore would break the fixpoint (unless it was fixed at 0, I guess).

robrix commented 10 years ago

Wait, we don’t do equality tests (as with Kleene fixpoints) any more—just non-0.