Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "step"

Index

Functions

Functions

Const step

  • step<A, B>(tx: TxLike<A, B>): (x: A) => B | B[]
  • Single-step transducer execution wrapper. Returns array if transducer produces multiple results and undefined if there was no output. Else returns single result value.

    remarks

    Likewise, once a transducer has produced a final / reduced value, all further invocations of the stepper function will return undefined.

    example
    // single result
    step(map(x => x * 10))(1);
    // 10
    
    // multiple results
    step(mapcat(x => [x, x + 1, x + 2]))(1)
    // [ 1, 2, 3 ]
    
    // no result
    f = step(filter((x) => !(x & 1)))
    f(1); // undefined
    f(2); // 2
    
    // reduced value termination
    f = step(take(2));
    f(1); // 1
    f(1); // 1
    f(1); // undefined
    f(1); // undefined

    Type parameters

    • A

    • B

    Parameters

    Returns (x: A) => B | B[]

      • (x: A): B | B[]
      • Parameters

        • x: A

        Returns B | B[]

Generated using TypeDoc