prepare for 0.17

This commit is contained in:
Simon Cruanes 2016-04-22 23:01:37 +02:00
parent bb74a33385
commit 73eecfb10d
26 changed files with 120 additions and 67 deletions

View file

@ -1,5 +1,58 @@
= Changelog
== 0.17
=== potentially breaking
- change the semantics of `CCString.find_all` (allow overlaps)
=== Additions
- add `CCString.pad` for more webscale
- add `(--^)` to CCRAl, CCFQueue, CCKlist (closes #56); add `CCKList.Infix`
- add monomorphic signatures in `CCInt` and `CCFloat`
- add `CCList.{sorted_insert,is_sorted}`
- add `CCLazy_list` in containers.iter (with a few functions)
- add `CCTrie.longest_prefix`
- provide additional ordering properties in `CCTrie.{above,below}`
- add `CCOpt.if_`
- have
* `CCRandom.split_list` fail on `len=0`
* `CCRandom.sample_without_replacement` fail if `n<=0`
- add `CCOpt.{for_all, exists}`
- add `CCRef.{get_then_incr,incr_then_get}`
- add `Result.{to,of}_err`
- add `CCFormat.within`
- add `map/mapi` to some of the map types.
- add `CCString.{drop,take,chop_prefix,chop_suffix,filter,filter_map}`
- add `CCList.fold_filter_map`
- add `CCIO.File.with_temp` for creating temporary files
- add `{CCArray,CCVector,CCList}.(--^)` for right-open ranges
- add `Containers.{Char,Result}`
- modify `CCPersistentHashtbl.merge` and add `CCMap.merge_safe`
- add `CCHet`, heterogeneous containers (table/map) indexed by keys
- add `CCString.rev`
- add `CCImmutArray` into containers.data
- add `CCList.Assoc.remove`
=== Fixes, misc
- Make `CCPersistentHashtbl.S.merge` more general.
- optimize KMP search in `CCString.Find` (hand-specialize code)
- bugfix in `CCFormat.to_file` (fd was closed too early)
- add a special case for pattern of length 1 in `CCString.find`
- more tests, bugfixes, and benchs for KMP in CCString
- in CCString, use KMP for faster sub-string search; add `find_all{,_l}`
others:
- `watch` target should build all
- add version constraint on sequence
- migrate to new qtest
- add an `IO` section to the tutorial
- enable `-j 0` for ocamlbuild
== 0.16
=== breaking

2
_oasis
View file

@ -1,6 +1,6 @@
OASISFormat: 0.4
Name: containers
Version: 0.16
Version: 0.17
Homepage: https://github.com/c-cube/ocaml-containers
Authors: Simon Cruanes
License: BSD-2-clause

View file

@ -168,7 +168,7 @@ val (--) : int -> int -> int t
val (--^) : int -> int -> int t
(** Range array, excluding right bound
@since NEXT_RELEASE *)
@since 0.17 *)
val random : 'a random_gen -> 'a t random_gen
val random_non_empty : 'a random_gen -> 'a t random_gen

View file

@ -79,25 +79,25 @@ val classify : float -> fpclass
(** {2 Infix Operators}
@since NEXT_RELEASE *)
@since 0.17 *)
module Infix : sig
val (=) : t -> t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val (<>) : t -> t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val (<) : t -> t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val (>) : t -> t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val (<=) : t -> t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val (>=) : t -> t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
end
include module type of Infix

View file

@ -39,7 +39,7 @@ val seq : ?start:string -> ?stop:string -> ?sep:string -> 'a printer -> 'a seque
val opt : 'a printer -> 'a option printer
(** In the tuple printers, the [sep] argument is only available
@since NEXT_RELEASE *)
@since 0.17 *)
val pair : ?sep:string -> 'a printer -> 'b printer -> ('a * 'b) printer
val triple : ?sep:string -> 'a printer -> 'b printer -> 'c printer -> ('a * 'b * 'c) printer
@ -49,7 +49,7 @@ val quad : ?sep:string -> 'a printer -> 'b printer ->
val within : string -> string -> 'a printer -> 'a printer
(** [within a b p] wraps [p] inside the strings [a] and [b]. Convenient,
for instances, for brackets, parenthesis, quotes, etc.
@since NEXT_RELEASE *)
@since 0.17 *)
val map : ('a -> 'b) -> 'b printer -> 'a printer

View file

@ -204,5 +204,5 @@ module File : sig
After [f] returns, the file is deleted. Best to be used in
combination with {!with_out}.
See {!Filename.temp_file}
@since NEXT_RELEASE *)
@since 0.17 *)
end

View file

@ -41,32 +41,32 @@ val of_string : string -> t option
(** @since 0.13 *)
val min : t -> t -> t
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val max : t -> t -> t
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
(** {2 Infix Operators}
@since NEXT_RELEASE *)
@since 0.17 *)
module Infix : sig
val (=) : t -> t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val (<>) : t -> t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val (<) : t -> t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val (>) : t -> t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val (<=) : t -> t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val (>=) : t -> t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
end
include module type of Infix

View file

@ -56,7 +56,7 @@ val fold_map2 : ('acc -> 'a -> 'b -> 'acc * 'c) -> 'acc -> 'a list -> 'b list ->
val fold_filter_map : ('acc -> 'a -> 'acc * 'b option) -> 'acc -> 'a list -> 'acc * 'b list
(** [fold_filter_map f acc l] is a [fold_left]-like function, but also
generates a list of output in a way similar to {!filter_map}
@since NEXT_RELEASE *)
@since 0.17 *)
val fold_flat_map : ('acc -> 'a -> 'acc * 'b list) -> 'acc -> 'a list -> 'acc * 'b list
(** [fold_flat_map f acc l] is a [fold_left]-like function, but it also maps the
@ -187,14 +187,14 @@ val sorted_merge_uniq : ?cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list
val is_sorted : ?cmp:('a -> 'a -> int) -> 'a list -> bool
(** [is_sorted l] returns [true] iff [l] is sorted (according to given order)
@param cmp the comparison function (default [Pervasives.compare])
@since NEXT_RELEASE *)
@since 0.17 *)
val sorted_insert : ?cmp:('a -> 'a -> int) -> ?uniq:bool -> 'a -> 'a list -> 'a list
(** [sorted_insert x l] inserts [x] into [l] such that, if [l] was sorted,
then [sorted_insert x l] is sorted too.
@param uniq if true and [x] is already in sorted position in [l], then
[x] is not duplicated. Default [false] ([x] will be inserted in any case).
@since NEXT_RELEASE *)
@since 0.17 *)
(*$Q
Q.(pair small_int (list small_int)) (fun (x,l) -> \
@ -288,7 +288,7 @@ val (--) : int -> int -> int t
val (--^) : int -> int -> int t
(** Infix alias for [range']
@since NEXT_RELEASE *)
@since 0.17 *)
val replicate : int -> 'a -> 'a t
(** Replicate the given element [n] times *)
@ -324,7 +324,7 @@ module Assoc : sig
val remove : ?eq:('a->'a->bool) -> ('a,'b) t -> 'a -> ('a,'b) t
(** [remove l k] removes the first occurrence of [k] from [l].
@since NEXT_RELEASE *)
@since 0.17 *)
end
(** {2 Zipper} *)
@ -511,7 +511,7 @@ module Infix : sig
val (--) : int -> int -> int t
val (--^) : int -> int -> int t
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
end
(** {2 IO} *)

View file

@ -28,7 +28,7 @@ module type S = sig
f:(key -> [`Left of 'a | `Right of 'b | `Both of 'a * 'b] -> 'c option) ->
'a t -> 'b t -> 'c t
(** [merge_safe ~f a b] merges the maps [a] and [b] together.
@since NEXT_RELEASE *)
@since 0.17 *)
val of_seq : (key * 'a) sequence -> 'a t

View file

@ -31,7 +31,7 @@ module type S = sig
f:(key -> [`Left of 'a | `Right of 'b | `Both of 'a * 'b] -> 'c option) ->
'a t -> 'b t -> 'c t
(** [merge_safe ~f a b] merges the maps [a] and [b] together.
@since NEXT_RELEASE *)
@since 0.17 *)
val of_seq : (key * 'a) sequence -> 'a t

View file

@ -52,13 +52,13 @@ val filter : ('a -> bool) -> 'a t -> 'a t
val if_ : ('a -> bool) -> 'a -> 'a option
(** [if_ f x] is [Some x] if [f x], [None] otherwise
@since NEXT_RELEASE *)
@since 0.17 *)
val exists : ('a -> bool) -> 'a t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val for_all : ('a -> bool) -> 'a t -> bool
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val get : 'a -> 'a t -> 'a
(** [get default x] unwraps [x], but if [x = None] it returns [default] instead.

View file

@ -26,11 +26,11 @@ val update : ('a -> 'a) -> 'a t -> unit
val incr_then_get : int t -> int
(** [incr_then_get r] increments [r] and returns its new value, think [++ r]
@since NEXT_RELEASE *)
@since 0.17 *)
val get_then_incr : int t -> int
(** [get_then_incr r] increments [r] and returns its old value, think [r++]
@since NEXT_RELEASE *)
@since 0.17 *)
val compare : 'a ord -> 'a t ord

View file

@ -184,10 +184,10 @@ val to_seq : ('a, _) t -> 'a sequence
type ('a, 'b) error = [`Ok of 'a | `Error of 'b]
val of_err : ('a, 'b) error -> ('a, 'b) t
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val to_err : ('a, 'b) t -> ('a, 'b) error
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
(** {2 IO} *)

View file

@ -65,7 +65,7 @@ val init : int -> (int -> char) -> string
val rev : string -> string
(** [rev s] returns the reverse of [s]
@since NEXT_RELEASE *)
@since 0.17 *)
(*$Q
Q.printable_string (fun s -> s = rev (rev s))
@ -83,7 +83,7 @@ val pad : ?side:[`Left|`Right] -> ?c:char -> int -> string -> string
and pads it on the [side] with [c] if it's not the case.
@param side determines where padding occurs (default: [`Left])
@param c the char used to pad (default: ' ')
@since NEXT_RELEASE *)
@since 0.17 *)
(*$= & ~printer:Q.Print.string
" 42" (pad 4 "42")
@ -128,13 +128,13 @@ val find_all : ?start:int -> sub:string -> string -> int gen
(** [find_all ~sub s] finds all occurrences of [sub] in [s], even overlapping
instances.
@param start starting position in [s]
@since NEXT_RELEASE *)
@since 0.17 *)
val find_all_l : ?start:int -> sub:string -> string -> int list
(** [find_all ~sub s] finds all occurrences of [sub] in [s] and returns
them in a list
@param start starting position in [s]
@since NEXT_RELEASE *)
@since 0.17 *)
(*$= & ~printer:Q.Print.(list int)
[1; 6] (find_all_l ~sub:"bc" "abc aabc aab")
@ -222,7 +222,7 @@ val suffix : suf:string -> string -> bool
val chop_prefix : pre:string -> string -> string option
(** [chop_pref ~pre s] removes [pre] from [s] if [pre] really is a prefix
of [s], returns [None] otherwise
@since NEXT_RELEASE *)
@since 0.17 *)
(*$= & ~printer:Q.Print.(option string)
(Some "cd") (chop_prefix ~pre:"aab" "aabcd")
@ -233,7 +233,7 @@ val chop_prefix : pre:string -> string -> string option
val chop_suffix : suf:string -> string -> string option
(** [chop_suffix ~suf s] removes [suf] from [s] if [suf] really is a suffix
of [s], returns [None] otherwise
@since NEXT_RELEASE *)
@since 0.17 *)
(*$= & ~printer:Q.Print.(option string)
(Some "ab") (chop_suffix ~suf:"cd" "abcd")
@ -243,15 +243,15 @@ val chop_suffix : suf:string -> string -> string option
val take : int -> string -> string
(** [take n s] keeps only the [n] first chars of [s]
@since NEXT_RELEASE *)
@since 0.17 *)
val drop : int -> string -> string
(** [drop n s] removes the [n] first chars of [s]
@since NEXT_RELEASE *)
@since 0.17 *)
val take_drop : int -> string -> string * string
(** [take_drop n s = take n s, drop n s]
@since NEXT_RELEASE *)
@since 0.17 *)
(*$=
("ab", "cd") (take_drop 2 "abcd")
@ -313,7 +313,7 @@ val mapi : (int -> char -> char) -> string -> string
@since 0.12 *)
val filter_map : (char -> char option) -> string -> string
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
(*$= & ~printer:Q.Print.string
"bcef" (filter_map \
@ -321,7 +321,7 @@ val filter_map : (char -> char option) -> string -> string
*)
val filter : (char -> bool) -> string -> string
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
(*$= & ~printer:Q.Print.string
"abde" (filter (function 'c' -> false | _ -> true) "abcdec")

View file

@ -240,7 +240,7 @@ val (--) : int -> int -> (int, 'mut) t
val (--^) : int -> int -> (int, 'mut) t
(** Range of integers, either ascending or descending, but excluding right.,
Example: [1 --^ 10] returns the vector [[1;2;3;4;5;6;7;8;9]]
@since NEXT_RELEASE *)
@since 0.17 *)
val of_array : 'a array -> ('a, 'mut) t
val of_list : 'a list -> ('a, 'mut) t

View file

@ -85,7 +85,7 @@ module Char = struct
include Char
include (CCChar : module type of CCChar with type t := t)
end
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
module Result = CCResult
(** @since NEXT_RELEASE *)
(** @since 0.17 *)

View file

@ -129,7 +129,7 @@ val (--) : int -> int -> int t
val (--^) : int -> int -> int t
(** [a -- b] is the integer range from [a] to [b], where [b] is excluded.
@since NEXT_RELEASE *)
@since 0.17 *)
val print : 'a printer -> 'a t printer
(** @since 0.13 *)

View file

@ -6,7 +6,7 @@
This is similar to {!CCMixtbl}, but the injection is directly used as
a key.
@since NEXT_RELEASE *)
@since 0.17 *)
type 'a sequence = ('a -> unit) -> unit
type 'a gen = unit -> 'a option

View file

@ -7,7 +7,7 @@
Sadly, it is not possible to make this type covariant without using black
magic.
@since NEXT_RELEASE *)
@since 0.17 *)
type 'a t
(** Array of values of type 'a. The underlying type really is

View file

@ -67,10 +67,10 @@ val iter : (int -> 'a -> unit) -> 'a t -> unit
val fold : (int -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val map : ('a -> 'b) -> 'a t -> 'b t
(** @since NEXT_RELEASE *)
(** @since 0.17 *)
val choose : 'a t -> (int * 'a) option

View file

@ -178,7 +178,7 @@ module Infix : sig
val (--^) : int -> int -> int t
(** [a -- b] is the integer range from [a] to [b], where [b] is excluded.
@since NEXT_RELEASE *)
@since 0.17 *)
end
include module type of Infix

View file

@ -52,7 +52,7 @@ module type S = sig
Example: if [m] has keys "abc0" and "abcd", then [longest_prefix "abc2" m]
will return "abc"
@since NEXT_RELEASE *)
@since 0.17 *)
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
(** Update the binding for the given key. The function is given
@ -65,11 +65,11 @@ module type S = sig
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
(** Map values, giving both key and value. Will use {!WORD.of_list} to rebuild keys.
@since NEXT_RELEASE *)
@since 0.17 *)
val map : ('a -> 'b) -> 'a t -> 'b t
(** Map values, giving only the value.
@since NEXT_RELEASE *)
@since 0.17 *)
val iter : (key -> 'a -> unit) -> 'a t -> unit
(** Same as {!fold}, but for effectful functions *)

View file

@ -52,7 +52,7 @@ module type S = sig
Example: if [m] has keys "abc0" and "abcd", then [longest_prefix "abc2" m]
will return "abc"
@since NEXT_RELEASE *)
@since 0.17 *)
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
(** Update the binding for the given key. The function is given
@ -65,11 +65,11 @@ module type S = sig
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
(** Map values, giving both key and value. Will use {!WORD.of_list} to rebuild keys.
@since NEXT_RELEASE *)
@since 0.17 *)
val map : ('a -> 'b) -> 'a t -> 'b t
(** Map values, giving only the value.
@since NEXT_RELEASE *)
@since 0.17 *)
val iter : (key -> 'a -> unit) -> 'a t -> unit
(** Same as {!fold}, but for effectful functions *)

View file

@ -64,12 +64,12 @@ module type S = sig
val mapi : f:(key -> 'a -> 'b) -> 'a t -> 'b t
(** Map values, giving both key and value. Will use {!WORD.of_list} to rebuild keys.
@since NEXT_RELEASE
@since 0.17
*)
val map : f:('a -> 'b) -> 'a t -> 'b t
(** Map values, giving only the value.
@since NEXT_RELEASE
@since 0.17
*)
val iter : f:(key -> 'a -> unit) -> 'a t -> unit

View file

@ -135,7 +135,7 @@ val (--) : int -> int -> int t
val (--^) : int -> int -> int t
(** [a -- b] is the integer range from [a] to [b], where [b] is excluded.
@since NEXT_RELEASE *)
@since 0.17 *)
(** {2 Operations on two Collections} *)
@ -212,7 +212,7 @@ val (<.>) : ('a -> 'b) t -> 'a t -> 'b t
(** {2 Infix operators}
@since NEXT_RELEASE *)
@since 0.17 *)
module Infix : sig
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

View file

@ -3,7 +3,7 @@
(** {1 Lazy List}
@since NEXT_RELEASE *)
@since 0.17 *)
type +'a t = 'a node lazy_t
and +'a node =