Cantor set: Difference between revisions
m
→JavaScript :: Dual representation
(→JavaScript :: Dual representation: Updated primitives, tidied.) |
|||
Line 1,833:
// intervalRatios :: [(Rational, Rational)] -> String
const intervalRatios = xs => {
const go =
Array.from(
compose(showRatio, rational)
)
Line 1,846:
const go = w => xs =>
snd(mapAccumL(
a =>
const [wx, wy] = Array.from(
r => ratioMult(w)(
rational(r)
Line 1,951:
// fst :: (a, b) -> a
const fst =
// First member of a pair.
Line 2,018:
acc => xs => [...xs].reduce(
(a, x) => {
const
return [
},
[acc, []]
Line 2,146:
// snd :: (a, b) -> b
const snd =
// Second member of a pair.
|