reduceRight
neuro.bigUint64Array.reduceRight
Section titled “neuro.bigUint64Array.reduceRight”Instance method on BigUint64Array.prototype.
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
Signatures
Section titled “Signatures”reduceRight(input: { bigUint64Array: <receiver>; callbackfn?: (previousValue: bigint; currentValue: bigint; currentIndex: number; array: BigUint64Array) => bigint; prompt?: string }): Promise<bigint>reduceRight(input: { bigUint64Array: <receiver>; callbackfn?: (previousValue: U; currentValue: bigint; currentIndex: number; array: BigUint64Array) => U; initialValue?: U; prompt?: string }): Promise<U>The prompt field is optional. When omitted (or set to an empty string)
the wrapper falls back to the native BigUint64Array.prototype.reduceRight and returns a
resolved Promise without contacting the LLM. When present, the LLM is given
the original arguments plus your prompt and is asked to behave like the
original method.
Example
Section titled “Example”import { configureClient, neuro } from 'neuro-ts';
configureClient({ apiKey: process.env.OPENAI_API_KEY });
// BigUint64Array reduceRight; useful for IIR-filter-shaped folds.await neuro.bigUint64Array.reduceRight({ bigUint64Array: view, callbackfn: (a, b) => a + b, initialValue: 0, prompt: 'fold the BigUint64Array right starting from initialValue, applying callbackfn from tail to head, the symmetry partner of reduce that finally pays its rent in DSP code' });System prompt
Section titled “System prompt”The exact system prompt the SDK sends to your model when you provide a
prompt field:
BigUint64Array.prototype.reduceRightYou are simulating the JavaScript built-in `BigUint64Array.prototype.reduceRight`.
## Original signature(s)
Overload 1: (callbackfn?: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array) => bigint) => bigint
Overload 2: (callbackfn?: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array) => U, initialValue?: U) => U
## JSDoc
Calls the specified callback function for all the elements in an array, in descending order.
The return value of the callback function is the accumulated result, and is provided as an
argument in the next call to the callback function.
## How to respond
- Behave EXACTLY as the original `reduceRight` would, but use the user's intent to choose any callback / comparator / transform logic that the original would normally accept as an argument.
- Strictly preserve the original return type and shape.
- Output ONLY the JSON-encoded return value of the function call.
- Do NOT include explanations, prose, comments, or markdown fences.
- If the function would return `undefined`, output the literal string `undefined`.
- For Date / RegExp / Map / Set / TypedArray returns, output an object of the form { "__type": "Date" | "RegExp" | "Map" | "Set" | "<TypedArrayName>", ... } so the SDK can rehydrate it.