package accessor_base

  1. Overview
  2. Docs

Source file accessor_float.ml

1
2
3
4
5
6
7
8
9
10
11
12
open! Base
open! Import

let negated = [%accessor Accessor.isomorphism ~get:Float.neg ~construct:Float.neg]
let added s = Accessor.isomorphism ~get:(fun a -> a +. s) ~construct:(fun a -> a -. s)
let subtracted s = Accessor.invert (added s)

let multiplied s =
  Accessor.isomorphism ~get:(fun a -> a *. s) ~construct:(fun a -> a /. s)
;;

let divided s = Accessor.invert (multiplied s)
OCaml

Innovation. Community. Security.