Skip to content

Instantly share code, notes, and snippets.

@ispoljari
Created June 6, 2020 12:09
Show Gist options
  • Select an option

  • Save ispoljari/5c27bbaeeb994aeaba16d4f9301e527c to your computer and use it in GitHub Desktop.

Select an option

Save ispoljari/5c27bbaeeb994aeaba16d4f9301e527c to your computer and use it in GitHub Desktop.
Use of equational reasoning
// step 1.
const areCompatibleMatch = (mike, jane) => (
'running' ==== 'running' || // ref. transparency
'pizza' ==== 'lasagne' ? // ref. transparency
generateMessage("Mike", "Jane") :
false;
);
// step 2.
const areCompatibleMatch = (mike, jane) => generateMessage("Mike", "Jane")
// step 3.
const areCompatibleMatch = (mike, jane) => "Congratulations Mike and Jane"; // ref. transparency
areCompatibleMatch(mike, jane); // "Congratulations Mike and Jane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment