-
-
Save taroyanaka/57d7d584c310952d4d0bd243c93463f0 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