geom
snapshot to clojars? The last one is now about 1.5 years behind the dev branch. :smile: I've been working on a CLJS environment for learners whose ugly SVG code I'd like to replace with something geom
-based.
movingAverage()
transducer can also be v. useful for charting purposes (e.g. trading charts) and there's a whole bunch of other related ideas in the thi.ng/indicators repo which are waiting to be refactored as transducers (currently implemented as iterators/generators)
movingAverage
is currently just:function movingAverage(n: number): Transducer<number, number> {
return comp(partition(n, 1, true), map((x) => reduce(mean(), x)));
}
function hexDump(cols = 16, addr = 0): Transducer<number, string> {
return comp(
padLast(cols, 0),
map(juxt(hex(2), (x) => x > 31 && x < 128 ? String.fromCharCode(x) : ".")),
partition(cols, true),
map(
juxt(
(x) => x.map(y => y[0]).join(" "),
(x) => x.map(y => y[1]).join("")
)
),
mapIndexed((i, [h, a]) => `${hex(8)(addr + i * cols)} | ${h} | ${a}`)
);
}
[...iterator(hexDump(8), [65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 33, 48, 49, 50, 51, 126, 122, 121, 120])]
// [ '00000000 | 41 42 43 44 45 46 47 48 | ABCDEFGH',
// '00000008 | 49 4a 21 30 31 32 33 7e | IJ!0123~',
// '00000010 | 7a 79 78 00 00 00 00 00 | zyx.....' ]