add label to ambiguous argument
This commit is contained in:
parent
9326f47ba2
commit
a2030efaca
2 changed files with 5 additions and 5 deletions
8
seq.ml
8
seq.ml
|
@ -50,13 +50,13 @@ let rec drop_while p seq =
|
|||
| Cons (x, xs) ->
|
||||
if p x then drop_while p xs else cons x xs
|
||||
|
||||
let chunks p =
|
||||
let chunks ~sep =
|
||||
unfold (fun seq ->
|
||||
match break' p seq with
|
||||
match break' sep seq with
|
||||
| Empty_seq -> None
|
||||
| Span (lst, seq) -> Some (lst, drop_while p seq))
|
||||
| Span (lst, seq) -> Some (lst, drop_while sep seq))
|
||||
|
||||
let line_chunks' = chunks (fun s -> s = "")
|
||||
let line_chunks' = chunks ~sep:(fun s -> s = "")
|
||||
let line_chunks ?(join=" ") seq = map (String.concat join) (line_chunks' seq)
|
||||
|
||||
let%test_module _ = (module struct
|
||||
|
|
2
seq.mli
2
seq.mli
|
@ -11,7 +11,7 @@ val break: ('a -> bool) -> 'a t -> 'a list * 'a t
|
|||
val drop_while: ('a -> bool) -> 'a t -> 'a t
|
||||
|
||||
|
||||
val chunks: ('a -> bool) -> 'a t -> 'a list t
|
||||
val chunks: sep:('a -> bool) -> 'a t -> 'a list t
|
||||
|
||||
val line_chunks': string t -> string list t
|
||||
val line_chunks: ?join:string -> string t -> string t
|
||||
|
|
Loading…
Reference in a new issue