diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f336ee..cf96d4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.10 + +- add `{union,inter,diff,subset}` +- add `{join_by,join_all_by,group_join_by}` +- add `find_map{,i}` as better alias to existing functions +- add `{max_exn,min_exn}` +- add `count` +- add `doc` and `test` to opam ## 0.9 diff --git a/README.adoc b/README.adoc index 311414b..719d098 100644 --- a/README.adoc +++ b/README.adoc @@ -169,6 +169,7 @@ enumerating the ways we can insert an element in a list. [source,OCaml] ---- +# open Sequence.Infix;; # module S = Sequence ;; # let rec insert x l = match l with | [] -> S.return [x] diff --git a/_oasis b/_oasis index eb4824c..ce827cf 100644 --- a/_oasis +++ b/_oasis @@ -1,6 +1,6 @@ OASISFormat: 0.4 Name: sequence -Version: 0.9 +Version: 0.10 Homepage: https://github.com/c-cube/sequence Authors: Simon Cruanes License: BSD-2-clause diff --git a/opam b/opam index 4081978..9f3cdf6 100644 --- a/opam +++ b/opam @@ -1,6 +1,6 @@ opam-version: "1.2" name: "sequence" -version: "0.9" +version: "0.10" author: "Simon Cruanes" maintainer: "simon.cruanes@inria.fr" license: "BSD-2-clauses" diff --git a/src/Sequence.mli b/src/Sequence.mli index fb16c81..f7f367a 100644 --- a/src/Sequence.mli +++ b/src/Sequence.mli @@ -149,7 +149,7 @@ val find : ('a -> 'b option) -> 'a t -> 'b option val find_map : ('a -> 'b option) -> 'a t -> 'b option (** Alias to {!find} - @since NEXT_RELEASE *) + @since 0.10 *) val findi : (int -> 'a -> 'b option) -> 'a t -> 'b option (** Indexed version of {!find} @@ -157,7 +157,7 @@ val findi : (int -> 'a -> 'b option) -> 'a t -> 'b option val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option (** Alias to {!findi} - @since NEXT_RELEASE *) + @since 0.10 *) val find_pred : ('a -> bool) -> 'a t -> 'a option (** [find_pred p l] finds the first element of [l] that satisfies [p], @@ -256,7 +256,7 @@ val count : ?hash:('a -> int) -> ?eq:('a -> 'a -> bool) -> 'a t -> ('a * int) t (** Map each distinct element to its number of occurrences in the whole seq. Similar to [group_by seq |> map (fun l->List.hd l, List.length l)] - @since NEXT_RELEASE *) + @since 0.10 *) val uniq : ?eq:('a -> 'a -> bool) -> 'a t -> 'a t (** Remove consecutive duplicate elements. Basically this is @@ -300,7 +300,7 @@ val join_by : ?eq:'key equal -> ?hash:'key hash -> values [(x,y)] from [(a,b)] with the same [key] using [merge]. If [merge] returns [None], the combination of values is discarded. - @since NEXT_RELEASE *) + @since 0.10 *) val join_all_by : ?eq:'key equal -> ?hash:'key hash -> ('a -> 'key) -> ('b -> 'key) -> @@ -317,7 +317,7 @@ val join_all_by : ?eq:'key equal -> ?hash:'key hash -> - call [merge k l1 l2]. If [merge] returns [None], the combination of values is discarded, otherwise it returns [Some c] and [c] is inserted in the result. - @since NEXT_RELEASE *) + @since 0.10 *) val group_join_by : ?eq:'a equal -> ?hash:'a hash -> ('b -> 'a) -> @@ -329,14 +329,14 @@ val group_join_by : ?eq:'a equal -> ?hash:'a hash -> sequence such that [eq x (key y)]. Elements of the first sequences without corresponding values in the second one are mapped to [[]] - @since NEXT_RELEASE *) + @since 0.10 *) val inter : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t (** Intersection of two collections. Each element will occur at most once in the result. Eager. - @since NEXT_RELEASE *) + @since 0.10 *) (*$= [2;4;5;6] (inter (1--6) (cons 2 (4--10)) |> sort |> to_list) @@ -348,7 +348,7 @@ val union : 'a t -> 'a t -> 'a t (** Union of two collections. Each element will occur at most once in the result. Eager. - @since NEXT_RELEASE *) + @since 0.10 *) (*$= [2;4;5;6] (union (4--6) (cons 2 (4--5)) |> sort |> to_list) @@ -358,7 +358,7 @@ val diff : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t (** Set difference. Eager. - @since NEXT_RELEASE *) + @since 0.10 *) (*$= [1;2;8;9;10] (diff (1--10) (3--7) |> to_list) @@ -368,7 +368,7 @@ val subset : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> bool (** [subset a b] returns [true] if all elements of [a] belong to [b]. Eager. - @since NEXT_RELEASE *) + @since 0.10 *) (*$T subset (2 -- 4) (1 -- 4) @@ -391,7 +391,7 @@ val max : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option val max_exn : ?lt:('a -> 'a -> bool) -> 'a t -> 'a (** Unsafe version of {!max} @raise Not_found if the sequence is empty - @since NEXT_RELEASE *) + @since 0.10 *) val min : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option (** Min element of the sequence, using the given comparison function. @@ -400,7 +400,7 @@ val min : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option val min_exn : ?lt:('a -> 'a -> bool) -> 'a t -> 'a (** Unsafe version of {!min} @raise Not_found if the sequence is empty - @since NEXT_RELEASE *) + @since 0.10 *) val head : 'a t -> 'a option (** First element, if any, otherwise [None] diff --git a/src/sequenceLabels.mli b/src/sequenceLabels.mli index 2829be4..b28e492 100644 --- a/src/sequenceLabels.mli +++ b/src/sequenceLabels.mli @@ -216,7 +216,7 @@ val count : ?hash:('a -> int) -> ?eq:('a -> 'a -> bool) -> 'a t -> ('a * int) t (** Map each distinct element to its number of occurrences in the whole seq. Similar to [group_by seq |> map (fun l->List.hd l, List.length l)] - @since NEXT_RELEASE *) + @since 0.10 *) val uniq : ?eq:('a -> 'a -> bool) -> 'a t -> 'a t (** Remove consecutive duplicate elements. Basically this is