@@ -66,7 +66,7 @@ changes in this release.
6666
67672 . Another large change is the removal (at last!) of functions deprecated
6868 in 2.8, related to the spread of ` Seq.t ` as the standard iterator type.
69- Functions like ` CCVector .of_seq` now operate on this standard ` Seq.t ` type,
69+ Functions like ` CCVec .of_seq` now operate on this standard ` Seq.t ` type,
7070 and old-time iteration based on [ iter] ( https://github.com/c-cube/iter )
7171 is now named ` of_iter ` , ` to_iter ` , etc.
7272
@@ -439,18 +439,14 @@ map =
439439- : string option = Some "33"
440440```
441441
442- ### New types: ` CCVector ` , ` CCHeap ` , ` CCResult ` , ` CCSexp ` , ` CCByte_buffer `
442+ ### New types: ` CCVec ` , ` CCHeap ` , ` CCResult ` , ` CCSexp ` , ` CCByte_buffer `
443443
444444Containers also contains (!) a few datatypes that are not from the standard
445445library but that are useful in a lot of situations:
446446
447- - ` CCVector ` :
448- A resizable array, with a mutability parameter. A value of type
449- ` ('a, CCVector.ro) CCVector.t ` is an immutable vector of values of type ` 'a ` ,
450- whereas a ` ('a, CCVector.rw) CCVector.t ` is a mutable vector that
451- can be modified. This way, vectors can be used in a quite functional
452- way, using operations such as ` map ` or ` flat_map ` , or in a more
453- imperative way.
447+ - ` CCVec ` :
448+ A simple and efficient dynamic array.
449+ This was called ` CCVector ` but the old module is deprecated now.
454450- ` CCHeap ` :
455451 A priority queue (currently, leftist heaps) functorized over
456452 a module ` sig val t val leq : t -> t -> bool ` that provides a type ` t `
@@ -474,43 +470,42 @@ library but that are useful in a lot of situations:
474470Now for a few examples:
475471
476472``` ocaml
477- # (* create a new empty vector. It is mutable, for otherwise it would
478- not be very useful. *)
479- CCVector.create;;
480- - : unit -> ('a, CCVector.rw) CCVector.t = <fun>
481-
482- # (* init, similar to Array.init, can be used to produce a
483- vector that is mutable OR immutable (see the 'mut parameter?) *)
484- CCVector.init ;;
485- - : int -> (int -> 'a) -> ('a, 'mut) CCVector.t = <fun>
473+ # (* create a new empty vector. *)
474+ CCVec.create;;
475+ - : unit -> 'a CCVec.t = <fun>
476+
477+ # (* init, similar to Array.init, can be used to produce a new vector
478+ of given size *)
479+ CCVec.init ;;
480+ - : int -> (int -> 'a) -> 'a CCVec.t = <fun>
486481```
487482
488483``` ocaml non-deterministic=output
489484# (* use the infix (--) operator for creating a range. Notice
490485 that v is a vector of integer but its mutability is not
491486 decided yet. *)
492- let v = CCVector .(1 -- 10);;
487+ let v = CCVec .(1 -- 10);;
493488val v : (int, '_a) CCVector.t = <abstr>
494489```
495490
496491``` ocaml
497- # Format.printf "v = @[%a@]@." (CCVector .pp CCInt.pp) v;;
492+ # Format.printf "v = @[%a@]@." (CCVec .pp CCInt.pp) v;;
498493v = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
499494- : unit = ()
500- # CCVector .push v 42;;
495+ # CCVec .push v 42;;
501496- : unit = ()
502497
503498# v (* now v is a mutable vector *);;
504- - : ( int, CCVector.rw) CCVector .t = <abstr>
499+ - : int CCVec .t = <abstr>
505500
506501# (* functional combinators! *)
507- let v2 : _ CCVector.ro_vector = v
508- |> CCVector .map (fun x-> x+1)
509- |> CCVector .filter (fun x-> x mod 2=0)
510- |> CCVector .rev ;;
511- val v2 : int CCVector.ro_vector = <abstr>
502+ let v2 : _ CCVec.t = v
503+ |> CCVec .map (fun x-> x+1)
504+ |> CCVec .filter (fun x-> x mod 2=0)
505+ |> CCVec .rev ;;
506+ val v2 : int CCVec.t = <abstr>
512507
513- # Format.printf "v2 = @[%a@]@." (CCVector .pp CCInt.pp) v2;;
508+ # Format.printf "v2 = @[%a@]@." (CCVec .pp CCInt.pp) v2;;
514509v2 = 10, 8, 6, 4, 2
515510- : unit = ()
516511```
@@ -521,7 +516,7 @@ module IntHeap = CCHeap.Make(struct type t = int let leq = (<=) end);;
521516```
522517
523518``` ocaml
524- # let h = v2 |> CCVector .to_iter |> IntHeap.of_iter ;;
519+ # let h = v2 |> CCVec .to_iter |> IntHeap.of_iter ;;
525520val h : IntHeap.t = <abstr>
526521
527522# (* We can print the content of h
0 commit comments