package accessor_core

  1. Overview
  2. Docs

Source file accessor_list.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
open! Core
open! Import
include Accessor.List

let zipped_with_remainder =
  [%accessor
    Accessor.isomorphism
      ~get:(fun (xs, ys) -> List.zip_with_remainder xs ys)
      ~construct:(fun (xyz, remainder) ->
        let xs, ys = List.unzip xyz in
        match remainder with
        | None -> xs, ys
        | Some (First xtl) -> xs @ xtl, ys
        | Some (Second ytl) -> xs, ys @ ytl)]
;;

let zipped = [%accessor zipped_with_remainder @> Accessor.Tuple2.fst]