import type { IProc } from "./api.js" ; import { AProc } from "./aproc.js" ; /**
 * Higher order  IProc . Constructs a new processor from given procs,
 * which accepts a single input and passes it to each of the given processors,
 * resulting in a tuple output (i.e. the input is processed in parallel (e.g.
 * for multi-band processing), unlike w/  serial ).
 *
 *  remarks In functional programming terms, the equivavelent is `juxt` (see
 * thi.ng/compose)
 *
 * See  bounce for combining results back into a single channel output.
 *
 *  param a param b export function multiplex < T , A , B > ( a , b ) ; export function multiplex < T , A , B , C > ( a , b , c ) ; export function multiplex < T , A , B , C , D > ( a , b , c , d ) ; export function multiplex < T > ( ... procs ) { return new Multiplex ( procs ) ; } export class Multiplex < A , B extends any [ ] > extends AProc < A , B > { protected _procs : IProc < A , any > [ ] ; constructor ( procs ) { super ( < B > procs . map ( ( p ) => p . deref ( ) ) ) ; this . _procs = procs ; } next ( x ) { return ( this . _val = < B > this . _procs . map ( ( p ) => p . next ( x ) ) ) ; } }