Memoize The Hashcodes
Some profiling has showed the Literal hashCode to be pretty expensive on graphs that fork and join a lot (very non-tree dags that use a lot of binary nodes).
Here we memoize Literal. Users should also memoize the hashCode of the nodes in their AST especially binary or variadic nodes.