Created
June 22, 2018 20:17
-
-
Save sebabouche/43c4ef8448d8fd482a3d27ede9486a24 to your computer and use it in GitHub Desktop.
ramda: cond, always, T, identity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { cond, always, lte, gte, T, __, identity } from "ramda" | |
const water = cond([ | |
[lte(__, 0), temp => `water freezes at ${temp}°C`], | |
[gte(__, 100), temp => `water boils at ${temp}°C`], | |
[T, temp => `nothing special happens at ${temp}°C`], | |
]) | |
console.log(water(-222)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment