package json-data-encoding

  1. Overview
  2. Docs
Type-safe encoding to and decoding from JSON

Install

dune-project
 Dependency

Authors

Maintainers

Sources

json-data-encoding-0.12.1.tar.gz
md5=f70939e5bcaae19f5996e05d3baf5536
sha512=891f3bc6aa12e9968bec9a18fdc594fd435a67b9291a9246cb4e6b9bc030181d5bab7a07a36632e492cbfebab3ad6ad65e9358fb3e41f26027eefb7a3337d0a9

doc/json-data-encoding/List_map/index.html

Module List_mapSource

Sourceval map_pure : ('a -> 'b) -> 'a list -> 'b list

Tail-recursive List.map alternative.

This map function is the one described in https://discuss.ocaml.org/t/a-new-list-map-that-is-both-stack-safe-and-fast/865

CAVEAT: The order of application of the function to the elements of the list is different from that of Stdlib.List.map. The function is applied in reverse order of the elements in the list. In other words:

map_pure f l is equivalent to List.rev_map f (List.rev l)

Considering this caveat, it is recommended to use this mapping function with a pure function as argument. This is why the name map_pure is chosen.

Sourceval mapi_pure : (int -> 'a -> 'b) -> 'a list -> 'b list
Sourceval append : 'a list -> 'a list -> 'a list

append is a tail-rec variant of List.append. It special cases small lists, and then it switches to List.rev_append.