diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index d3fc7b4d..ba33774d 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -39,8 +39,11 @@ export class Pattern { /** * Returns a new pattern, with the function applied to the value of * each hap. It has the alias {@link Pattern#fmap}. - * @param {Function} func + * @synonyms fmap + * @param {Function} func to to apply to the value * @returns Pattern + * @example + * "0 1 2".withValue(v => v + 10).log() */ withValue(func) { return new Pattern((state) => this.query(state).map((hap) => hap.withValue(func))); @@ -53,10 +56,15 @@ export class Pattern { return this.withValue(func); } + /** + * Assumes 'this' is a pattern of functions, and given a function to + * resolve wholes, applies a given pattern of values to that + * pattern of functions. + * @param {Function} whole_func + * @param {Function} func + * @returns Pattern + */ appWhole(whole_func, pat_val) { - // Assumes 'this' is a pattern of functions, and given a function to - // resolve wholes, applies a given pattern of values to that - // pattern of functions. const pat_func = this; const query = function (state) { const hap_funcs = pat_func.query(state); diff --git a/website/src/config.ts b/website/src/config.ts index c6cc9f59..02934613 100644 --- a/website/src/config.ts +++ b/website/src/config.ts @@ -74,6 +74,7 @@ export const SIDEBAR: Sidebar = { { text: 'REPL', link: 'technical-manual/repl' }, { text: 'Docs', link: 'technical-manual/docs' }, { text: 'Testing', link: 'technical-manual/testing' }, + { text: 'Internals', link: 'technical-manual/internals' }, ], }, }; diff --git a/website/src/pages/technical-manual/internals.mdx b/website/src/pages/technical-manual/internals.mdx new file mode 100644 index 00000000..979659ec --- /dev/null +++ b/website/src/pages/technical-manual/internals.mdx @@ -0,0 +1,189 @@ +--- +title: Internals +layout: ../../layouts/MainLayout.astro +--- + +import { MiniRepl } from '../../docs/MiniRepl'; +import { JsDoc } from '../../docs/JsDoc'; + +# Internal Functions + +These functions are more low level, probably not needed by the live coder. + +# Haskell-style functor, applicative and monadic operations + +## withValue + + + +## appWhole + + + +## appBoth + + + +## appLeft + + + +## appRight + + + +## bindWhole + + + +## bind + + + +## join + + + +## outerBind + + + +## outerJoin + + + +## innerBind + + + +## innerJoin + + + +## trigJoin + + + +## trigzeroJoin + + + +## squeezeJoin + + + +## squeezeBind + + + +# Utility methods mainly for internal use + +## queryArc + + + +## splitQueries + + + +## withQuerySpan + + + +## withQuerySpanMaybe + + + +## withQueryTime + + + +## withHapSpan + + + +## withHapTime + + + +## withHaps + + + +## withHap + + + +## setContext + + + +## withContext + + + +## stripContext + + + +## withLocation + + + +## withMiniLocation + + + +## filterHaps + + + +## filterValues + + + +## removeUndefineds + + + +## onsetsOnly + + + +## discreteOnly + + + +## defragmentHaps + + + +## firstCycle + + + +## firstCycleValues + + + +## showFirstCycle + + + +## sortHapsByPart + + + +## asNumber + + + +# Operators + +- \_opIn +- \_opOut +- \_opMix +- \_opSqueeze +- \_opSqueezeOut +- \_opTrig +- \_opTrigzero