Skip to content

Commit

Permalink
Array: make_float: int -> float array
Browse files Browse the repository at this point in the history
  • Loading branch information
gasche committed Sep 23, 2014
1 parent 551954f commit 719aac2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/batArray.mliv
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ external make : int -> 'a -> 'a array = "caml_make_vect"
If the value of [x] is a floating-point number, then the maximum
size is only [Sys.max_array_length / 2].*)

##V<4.2##val make_float : int -> float array
##V>=4.2##external make_float : int -> float array = "caml_make_float_vect"
(** [Array.make_float n] returns a fresh float array of length [n],
with uninitialized data.

@since v2.3.0 and OCaml 4.2.0
*)

external create : int -> 'a -> 'a array = "caml_make_vect"
(** @deprecated [Array.create] is an alias for {!Array.make}. *)

Expand Down Expand Up @@ -624,6 +632,14 @@ sig
external make : int -> 'a -> ('a, _) t = "caml_make_vect"
external create : int -> 'a -> ('a, _) t = "caml_make_vect"

##V<4.2## val make_float : int -> (float, _) t
##V>=4.2## external make_float : int -> (float, _) t = "caml_make_float_vect"
(** [Array.make_float n] returns a fresh float array of length [n],
with uninitialized data.

@since 2.3.0 and OCaml 4.2.0
*)

external of_array : 'a array -> ('a, _ ) t = "%identity"
(** Adopt a regular array as a capability array, allowing
to decrease capabilities if necessary.
Expand Down
7 changes: 7 additions & 0 deletions src/batArray.mlv
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ type 'a mappable = 'a t

include Array

(* added in legacy Array in 4.02 *)
##V<4.2##let make_float n = make n 0.

let singleton x = [|x|]
(*$Q singleton
Q.int (fun x -> let s = singleton x in s.(0) = x && length s = 1)
Expand Down Expand Up @@ -787,6 +790,10 @@ struct
external make : int -> 'a -> ('a, _) t = "caml_make_vect"
external create : int -> 'a -> ('a, _) t = "caml_make_vect"


##V>=4.2## external make_float: int -> (float, _) t = "caml_make_float_vect"
##V<4.2## let make_float n = make n 0.

let init = init
let make_matrix = make_matrix
let create_matrix= create_matrix
Expand Down

0 comments on commit 719aac2

Please sign in to comment.