From b5f5bc24232c80c69394fe773ecb9757ba9635d4 Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Thu, 28 Nov 2019 21:53:23 +0000 Subject: [PATCH] refactor(examples): minor updates --- examples/mandelbrot/src/gradient.ts | 5 ++--- examples/mandelbrot/src/worker.ts | 2 +- examples/poly-spline/src/index.ts | 20 ++++++++++++++++---- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/examples/mandelbrot/src/gradient.ts b/examples/mandelbrot/src/gradient.ts index 51e6a4ddf3..66ea0220cd 100644 --- a/examples/mandelbrot/src/gradient.ts +++ b/examples/mandelbrot/src/gradient.ts @@ -1,6 +1,5 @@ -import { partial } from "@thi.ng/compose/partial"; -import { TAU } from "@thi.ng/math/api"; -import { clamp01 } from "@thi.ng/math/interval"; +import { partial } from "@thi.ng/compose"; +import { clamp01, TAU } from "@thi.ng/math"; import { comp, map, diff --git a/examples/mandelbrot/src/worker.ts b/examples/mandelbrot/src/worker.ts index 0fdb3d379e..d95007fc39 100644 --- a/examples/mandelbrot/src/worker.ts +++ b/examples/mandelbrot/src/worker.ts @@ -1,4 +1,4 @@ -import { fit01 } from "@thi.ng/math/fit"; +import { fit01 } from "@thi.ng/math"; import { GRADIENTS } from "./gradient"; // host message listener & responder diff --git a/examples/poly-spline/src/index.ts b/examples/poly-spline/src/index.ts index cdeef688eb..40b637a2b1 100644 --- a/examples/poly-spline/src/index.ts +++ b/examples/poly-spline/src/index.ts @@ -69,7 +69,7 @@ const slider = ( ...attribs } ], - stream.deref().toFixed(1) + stream.deref()!.toFixed(1) ]; // main app component / stream transformer @@ -90,12 +90,19 @@ const app = ( }); // visualize control points as circles const controlPoints = iterator( - comp(mapcat((x) => x.points), map((p) => circle(p, 0.75))), + comp( + mapcat((x) => x.points), + map((p) => circle(p, 0.75)) + ), cubics ); // visualize control point handles const handles = iterator( - comp(mapcat((x) => x.points), partition(2), map(line)), + comp( + mapcat((x) => x.points), + partition(2), + map(line) + ), cubics ); return [ @@ -174,7 +181,12 @@ const scale = stream(); const uniScale = stream(); // re-usable transducer implementing a toggle switch -const toggle = scan(reducer(() => true, (acc) => !acc)); +const toggle = scan( + reducer( + () => true, + (acc) => !acc + ) +); // main stream combinator const main = sync({