Skip to content

Instantly share code, notes, and snippets.

Juan Pablo de la Torre jpidelatorre

Block or report user

Report or block jpidelatorre

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jpidelatorre
jpidelatorre / fractions.annotated.js
Last active Sep 13, 2018
Returns an equivalent fraction to a number larger than 0 (limited by a rather limited call stack size cap)
View fractions.annotated.js
f = ( // Given
n, // A number greater than 0 (limited by the call stack size cap)
a, // An optional numerator
b // And an optional denominator
) =>
[ // Have a collection of functions that
_ => f(n, a + 1, b), // - Adds one to the numerator if the fraction is smaller than the number
_ => `${a}/${b}`, // - Returns a string of the resulting fraction if it's equal to the number
_ => f(n, a, b + 1), // - Adds one to the denominator if the fraction is larger than the number
][ // And return the value of one based on
@jpidelatorre
jpidelatorre / LICENSE.md
Last active Oct 17, 2018
Pub/Sub golf edition
View LICENSE.md

DON'T BLAME ME LICENSE

v0 Jun 2018

You are allowed to use, modify or distribute this piece of code as pleased. The author cannot be made responsible for anything that could derive from the use or misuse of this software.

You can’t perform that action at this time.