Hilbert curve: Difference between revisions

m
Line 1,817:
 
return Boolean(n) ? (
take(n)(iterate(go)(seed)).slice(-1)[0]
.slice(-1)[0]
) : seed;
};
Line 1,917 ⟶ 1,918:
// iterate :: (a -> a) -> a -> Gen [a]
const iterate = f =>
// An infinite list of repeated applications
// applications of f, starting with the seed tovalue x.
function* (x) {
let v = x;
Line 1,962 ⟶ 1,963:
xs => ys => {
const
lngn = Math.min(length(xs), length(ys)),
as = take(lngn)(xs),
bs = take(lngn)(ys);
 
return Array.from({
length: lngn
}, (_, i) => f(as[i], bs[i]));
};
9,655

edits