or run

npx @tessl/cli init
Log in

Version

Files

docs

function-utilities.mdindex.mdlist-operations.mdmathematical-operations.mdobject-operations.mdstring-processing.md
tile.json

task.mdevals/scenario-2/

Curried Argument Toolkit

Functional challenges centered on argument orchestration.

Capabilities

Invoke from list

  • invokeFromList calls the provided function with arguments from the given array without mutating it; using (a, b, c) => a + b + c and [2, 3, 5] returns 10. @test
  • An empty argument list works with a zero-argument function, returning its value (e.g., "done"). @test

Curried label builder

  • makeLabeler("[", "]", "Ada") yields [Ada], and the function can also be invoked in stages such as makeLabeler("Hello, ")("!")("Ada") to produce Hello, Ada!. @test
  • Prefixes, suffixes, and names are concatenated verbatim so spaces or punctuation are preserved exactly. @test

Swapped combination

  • With a subtract-like combiner, calling swapThenCombine with 10 and 3 produces -7 because the first two inputs are reversed before evaluation. @test
  • Extra arguments after the first two remain in order after the swap (e.g., combining (a, b, c) => (a - b) * c with inputs 2, 5, 2 yields 14). @test

Projected max repeater

  • Given [ {score: 3}, {score: 7}, {score: 5} ], a projector extracting score, and a copy count of 2, the function applies the projector to every candidate, returns an array containing the highest-scoring object twice, and leaves the input array unchanged. Ties keep the first encountered item. @test
  • When the projector is omitted the raw values are used; [1, 5, 3] with a copy count of 3 returns [5, 5, 5]. Passing a non-numeric copy count (e.g., "three") raises TypeError, and an empty input array returns an empty array. @test

Implementation

@generates

API

export function invokeFromList(fn, args);
export function makeLabeler(prefix, suffix, name);
export function swapThenCombine(combiner, first, second, ...rest);
export function projectedMaxRepeater(values, projector, copies);

Dependencies { .dependencies }

prelude.ls { .dependency }

Functional utility toolkit required for argument spreading, currying, swapped invocation, projection-based comparison, identity defaults, type guards, and value replication.

@satisfied-by