Skip to content

Instantly share code, notes, and snippets.

@jhannah
Last active August 1, 2018 22:30
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 jhannah/c301caffb83d43dad097841e1caad7d6 to your computer and use it in GitHub Desktop.
Save jhannah/c301caffb83d43dad097841e1caad7d6 to your computer and use it in GitHub Desktop.
Reduces?
{ "and": [
{ "==" : [ { "var": "gender" }, "women" ] },
{ "and": [
{ "<=" : [ { "var": "age" }, 34 ] },
{ ">=" : [ { "var": "age" }, 25 ] }
] },
{ "==": [ { "var": "have_childen" }, true ] }
]}
reduces to:
{[
{ "==" : [ { "var": "gender" }, "women" ] },
{ "<=" : [ { "var": "age" }, 34 ] },
{ ">=" : [ { "var": "age" }, 25 ] }
{ "==" : [ { "var": "have_childen" }, true ] }
]}
If we're inventing syntax? :
{[
[ "gender", "==", "women" ],
[ "age", "<=", 34 ],
[ "age", ">=", 25 ],
[ "have_children", "==", true ]
]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment