Skip to content

Instantly share code, notes, and snippets.

@joaomilho
Created June 3, 2016 23:19
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 joaomilho/b5070a3eabddd8561db6b45864f31d13 to your computer and use it in GitHub Desktop.
Save joaomilho/b5070a3eabddd8561db6b45864f31d13 to your computer and use it in GitHub Desktop.
const fn = cond([
[equals(0), always('water freezes at 0°C')],
[equals(100), always('water boils at 100°C')],
[T, (temp) => `nothing special happens at ${temp}°C`]
])
fn(0) //=> 'water freezes at 0°C'
fn(50) //=> 'nothing special happens at 50°C'
fn(100) //=> 'water boils at 100°C'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment