package fix

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Fix.EnumSource

This module offers a few functions that help deal with enumerations.

Sourcetype 'a enum

A value of type 'a enum is (a description of, or a producer of) a finite sequence of elements of type 'a.

Sourceval enum : (('a -> unit) -> unit) -> 'a enum

enum iter converts the function iter into an enumeration.

Sourceval foreach : 'a enum -> ('a -> unit) -> unit

foreach converts an enumeration to an iter function. Thus, a loop over an enumeration xs is written foreach xs (fun x -> ...).

Sourceval length : 'a enum -> int

length xs computes and returns the length of the enumeration xs. It runs in linear time. The enumeration xs must be persistent.

Sourceval empty : 'a enum

empty is an empty enumeration.

Sourceval cons : 'a -> 'a enum -> 'a enum

The enumeration cons x xs begins with x, followed with the elements of the enumeration xs.

Sourceval singleton : 'a -> 'a enum

The enumeration singleton x contains just the element x.

Sourceval list : 'a list -> 'a enum

list xs is an enumeration of the elements of the list xs.

Sourceval array : 'a array -> 'a enum

array xs is an enumeration of the elements of the array xs, from left to right. The array is read only when the elements of the enumeration are demanded.

Sourceval enum_to_list : 'a enum -> 'a list

enum_to_list xs demands the elements of the enumeration xs and returns a list of these elements. The elements appear in the list in the order of their production: that is, the first element of the list is the first element that was produced.

Sourceval enum_to_reversed_list : 'a enum -> 'a list

enum_to_reversed_list xs demands the elements of the enumeration xs and returns a list of these elements. The elements appear in the list in the reverse order of their production: that is, the first element of the list is the last element that was produced.

Sourceval enum_to_array : 'a enum -> 'a array

enum_to_array xs demands the elements of the enumeration xs and returns a (fresh) array of these elements. The elements appear in the array in the order of their production: that is, the first element of the array is the first element that was produced.

Sourceval enum_to_reversed_array : 'a enum -> 'a array

enum_to_reversed_array xs demands the elements of the enumeration xs and returns a (fresh) array of these elements. The elements appear in the array in the reverse order of their production: that is, the first element of the array is the last element that was produced.

Sourceval filter : ('a -> bool) -> 'a enum -> 'a enum

filter f xs is an enumeration of the elements x, where x ranges over xs and f x is true.

Sourceval map : ('a -> 'b) -> 'a enum -> 'b enum

map f xs is the enumeration of the elements f x, where x ranges over xs.

OCaml

Innovation. Community. Security.