sublists #
List.Sublists
gives a list of all (not necessarily contiguous) sublists of a list.
This file contains basic results on this function.
sublists #
Alias of List.sublistsAux_eq_flatMap
.
sublistsLen #
Auxiliary function to construct the list of all sublists of a given length. Given an
integer n
, a list l
, a function f
and an auxiliary list L
, it returns the list made of
f
applied to all sublists of l
of length n
, concatenated with L
.
Equations
- List.sublistsLenAux 0 x✝¹ x✝ x = x✝ [] :: x
- List.sublistsLenAux n.succ [] x✝ x = x
- List.sublistsLenAux n.succ (a :: l) x✝ x = List.sublistsLenAux (n + 1) l x✝ (List.sublistsLenAux n l (x✝ ∘ List.cons a) x)
Instances For
The list of all sublists of a list l
that are of length n
. For instance, for
l = [0, 1, 2, 3]
and n = 2
, one gets
[[2, 3], [1, 3], [1, 2], [0, 3], [0, 2], [0, 1]]
.
Equations
- List.sublistsLen n l = List.sublistsLenAux n l id []
Instances For
Alias of the reverse direction of List.nodup_sublists
.
Alias of the forward direction of List.nodup_sublists
.
Alias of the reverse direction of List.nodup_sublists'
.
Alias of the forward direction of List.nodup_sublists'
.