mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
minor details
This commit is contained in:
parent
88f006171f
commit
9edb610132
3 changed files with 7 additions and 3 deletions
|
|
@ -45,7 +45,9 @@ let make f f_len r r_len = match f with
|
|||
|
||||
let singleton x = make [x] 1 [] 0
|
||||
|
||||
let of_list l = make l (List.length l) [] 0
|
||||
let of_list l =
|
||||
if l = [] then raise (Invalid_argument "empty list");
|
||||
make l (List.length l) [] 0
|
||||
|
||||
let length l = l.f_len + l.r_len
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ val singleton : 'a -> 'a t
|
|||
|
||||
val of_list : 'a list -> 'a t
|
||||
(** build a circular list from a list. Linear in the length
|
||||
of the list *)
|
||||
of the list.
|
||||
@raise Invalid_argument if the list is empty *)
|
||||
|
||||
val length : 'a t -> int
|
||||
(** length of the cycle. *)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ The signature for a given string representation provides 3 main things:
|
|||
maximal distance).
|
||||
|
||||
A possible use of the index could be:
|
||||
[
|
||||
{[
|
||||
open Batteries;;
|
||||
|
||||
let words = File.with_file_in "/usr/share/dict/english"
|
||||
|
|
@ -88,6 +88,7 @@ let words = List.map (fun s->s,s) words;;
|
|||
let idx = Levenshtein.Index.of_list words;;
|
||||
|
||||
Levenshtein.Index.retrieve ~limit:1 idx "hell" |> Levenshtein.klist_to_list;;
|
||||
]}
|
||||
*)
|
||||
|
||||
module type S = sig
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue