package bap-future

  1. Overview
  2. Docs

Applying function to multiple streams.

This interface enables merging of arbitrary number of streams and processing them with a single function.

Example

let args = Stream.Variadic.(begin
    args input1 $input2 ... $inputN
  end)

let output =
  Stream.Variadic.apply args ~f:(fun x1 x2 ... xN ->
      (x1,x2,...,xN) (* or something more clever *))

where

  • `input1`, ..., `inputN` are streams of types `t1 stream`, ..., `tN stream`;
  • `output` is the merged stream of type `t1 * t2 * ... * tN`.
type ('f, 'r) t

('f,'r) t is a list of arguments, where 'f defines the arrow type of the arguments, and 'r is the return type. C.f., 'f and 'r with the first and last parameter of the format type constructor.

type 'a arg = 'a t

'a arg is an Applicable value

val args : 'a arg -> ('a -> 'b, 'b) t

args x creates a singleton list of arguments that can be applied to a function that takes x argument, and returns a value of type 'b.

val ($) : ('a, 'b -> 'c) t -> 'b arg -> ('a, 'c) t

args $x appends argument x to a list of arguments args.

val apply : f:'f -> ('f, 'r) t -> 'r arg

apply args ~f applies function f to arguments args.

OCaml

Innovation. Community. Security.