package alg_structs
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Non-empty lists
include Functor.S with type 'a t := 'a t
include Functor.Seed with type 'a t := 'a t
map ~f
maps the function f : 'a -> 'b
to a function 'f T : 'a T -> 'b T
.
As an example, if T (x : u) : u t
then map ~(f:u -> v) (T x)
is T (f
x) : v t
. As a result, map
is often thought of as applying f
"in" T
.
The function map
is the mapping of arrows, taking every arrow 'a -> 'b
to an arrow 'a t -> 'b t
.
val uncons : 'a t -> 'a * 'a list
uncons t
is (List.hd t, List.tl t)
.
val hd : 'a t -> 'a
hd t
is the first element of t
.
Since t
is non-empty, it is guaranteed that there will always be a head.
val tl : 'a t -> 'a list
tl t
are the elements of t
after, but not including the head.
Since t
is non-empty, it is guaranteed that there will always be a tail.
val fold : ('a -> 'a -> 'a) -> 'a t -> 'a
See List.concat
.
val of_list : 'a list -> 'a t option
of_list xs
is a Some
non-empty list of xs
if xs
isn't empty. Otherwise it is None
.
val to_list : 'a t -> 'a list
to_list t
is the list of the elements in t
.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>