Skip to content

Instantly share code, notes, and snippets.

@key-moon
Created October 12, 2018 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save key-moon/df07694b60935466d704dc09eea9701e to your computer and use it in GitHub Desktop.
Save key-moon/df07694b60935466d704dc09eea9701e to your computer and use it in GitHub Desktop.
Rules:
() + () = ()() => [combine]
((())) + () = ((())()) => [absorb-right]
() + ((())) = (()(())) => [absorb-left]
(())(()) + () = (())(()()) => [combined-absorb-right]
() + (())(()) = (()())(()) => [combined-absorb-left]
(())(()) + ((())) = ((())(())(())) => [absorb-combined-right]
((())) + (())(()) = ((())(())(())) => [absorb-combined-left]
() + (()) + ((())) = (()()) + ((())) = ((()())(())) => [left-associative]
Example:
(()) + () = () + (()) = (()())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment