package zar

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type 'a stream =
  1. | SCons of 'a * unit -> 'a stream

Streams / Lazy infinite lists.

val first : 'a stream -> 'a

First element (head) of a stream.

val rest : 'a stream -> 'a stream

Rest (tail) of a stream.

val take : int -> 'a stream -> 'a list

Take the first n elements of a stream.

val drop : int -> 'a stream -> 'a stream

Drop the first n elements of a stream.

val map : ('a -> 'b) -> 'a stream -> 'b stream

Map a function over a stream.

val scons : 'a -> 'a stream -> 'a stream

Build a stream from a head and tail.

val bits : unit -> bool stream

Default implementation of uniformly distributed random bit stream.

val seed : unit -> unit

Initialize PRNG used for default implementation of bit stream.

val coin_transformer : int -> int -> bool stream -> bool stream

Coin stream transformer.

val die_transformer : int -> bool stream -> int stream

Die stream transformer.

val findist_transformer : int list -> bool stream -> int stream

Findist stream transformer.

val coin : int -> int -> bool stream

Coin stream (applied to bits).

val die : int -> int stream

Die stream (applied to bits).

val findist : int list -> int stream

Findist stream (applied to bits).