package feat-core

  1. Overview
  2. Docs

Module IFSeq.MakeSource

Make constructs an implementation of the signature IFSeqSig.IFSEQ_EXTENDED. It is parameterized over an implementation of big integers and a random number generator.

Parameters

module R : RandomSig.S

Signature

include IFSeqSig.IFSEQ_BASIC with type index = Z.t
Sourcetype 'a seq

'a seq is the type of sequences whose elements have type 'a.

Constructors.

Sourceval empty : 'a seq

empty is a sequence of length zero.

Sourceval zero : 'a seq

zero is a synonym for empty.

Sourceval singleton : 'a -> 'a seq

singleton x is a sequence of length one whose single element is x.

Sourceval one : 'a -> 'a seq

one is a synonym for singleton.

Sourceval rev : 'a seq -> 'a seq

rev xs is the reverse of the sequence xs.

Sourceval sum : 'a seq -> 'a seq -> 'a seq

sum s1 s2 is the concatenation of the sequences s1 and s2.

Sourceval (++) : 'a seq -> 'a seq -> 'a seq

(++) is a synonym for sum.

Sourceval product : 'a seq -> 'b seq -> ('a * 'b) seq

product s1 s2 is the Cartesian product of the sequences s1 and s2. Its length is the product of the lengths of s1 and s2. The first pair component is considered most significant.

Sourceval (**) : 'a seq -> 'b seq -> ('a * 'b) seq

( ** ) is a synonym for product.

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

map phi s is the image of the sequence s through the function phi. If the user wishes to work with sequences of pairwise distinct elements, then phi should be injective. If furthermore the user wishes to work with sequences that enumerate all elements of a type, then phi should be surjective.

Sourceval up : int -> int -> int seq

up i j is the sequence of the integers from i included up to j excluded.

Sourcetype index = Z.t

The type index is the type of integers used to represent indices and lengths.

Sourceval length : 'a seq -> index

length s is the length of the sequence s.

Sourceval get : 'a seq -> index -> 'a

get s i is the i-th element of the sequence s. The index i must be comprised between zero included and length s excluded.

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

foreach s k iterates over all elements of the sequence s. Each element in turn is passed to the loop body k.

Sourceval to_seq : 'a seq -> 'a Seq.t -> 'a Seq.t

to_seq s k produces an explicit representation of the sequence s as a sequence in the sense of OCaml's standard library module Seq. This sequence is prepended in front of the existing sequence k.

Sourceval bigsum : 'a seq list -> 'a seq

Iterated sum.

Sourceval exists : 'a list -> ('a -> 'b seq) -> 'b seq

Indexed iterated sum.

Sourceval sample : int -> 'a seq -> 'a Seq.t -> 'a Seq.t

sample m s k is an explicit sequence of at most m elements extracted out of the implicit sequence s, prepended in front of the existing sequence k. If length s is at most m, then all elements of s are produced. Otherwise, a random sample of m elements extracted out of s is produced.

OCaml

Innovation. Community. Security.