package batteries

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module BatOrd.IncubatorSource

Sourceval eq_by : ('a -> 'b) -> 'a eq
Sourceval comp_by : ('a -> 'b) -> 'a comp
Sourceval ord_by : ('a -> 'b) -> 'a ord

Build a eq, cmp or ord function from a projection function. For example, if you wanted to compare integers based on their lowest 4 bits, you could write let cmp_bot4 = cmp_by (fun x -> x land 0xf) and use cmp_bot4 as the desired integer comparator.

OCaml

Innovation. Community. Security.