package apero-core

  1. Overview
  2. Docs

Source file alist.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
include List

let drop = Acommon.drop

let take = Acommon.take

let contains xs x = match List.find_opt  ((=) x) xs with 
| Some _ -> true 
| None -> false

let rec substract xs ys = match ys with
| [] -> xs
| h::tl -> substract (List.filter ((=) h) xs) tl

let zip = combine

let unzip = split

let  to_string ?(sep=", ") xs f =
  let s = match xs with
      | h::tl -> List.fold_left (fun a v -> Printf.sprintf "%s%s%s" a sep @@ f v) (f h) tl
      | [] -> ""
  in Printf.sprintf "(%s)" s