Skip to content

Instantly share code, notes, and snippets.

@mvaldesdeleon
Last active December 26, 2018 16:59
Show Gist options
  • Save mvaldesdeleon/646e90ac8a0d1e4138afedb25dcc160b to your computer and use it in GitHub Desktop.
Save mvaldesdeleon/646e90ac8a0d1e4138afedb25dcc160b to your computer and use it in GitHub Desktop.
result = foo . bar . baz $ value
result1 = foo $ bar $ baz $ value
result2 = foo $ bar . baz $ value
result3 = foo (bar . baz $ value)
result4 = (foo . bar) (baz value)
result5 = foo . bar $ baz value
-- etc...
-- Challenge to the reader: Given n terms (where in these examples n = 3),
-- how many different ways are there to write the above expressions?
-- Can you produce them all?
--
-- No single-term parens are allowed, e.g. (foo), since this would allow ((foo)), (((foo))), ...
-- and produce the trivial and boring solution of "Infinity"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment