package batteries
A community-maintained standard library extension
Install
Dune Dependency
Authors
Maintainers
Sources
v3.9.0.tar.gz
md5=ea26b5c72e6731e59d856626049cca4d
sha512=55975b62c26f6db77433a3ac31f97af609fc6789bb62ac38b267249c78fd44ff37fe81901f1cf560857b9493a6046dd37b0d1c0234c66bd59e52843aac3ce6cb
doc/src/batteries.unthreaded/batBool.ml.html
Source file batBool.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
(* * BatBool - Extended booleans * Copyright (C) 2007 Bluestorm <bluestorm dot dylc on-the-server gmail dot com> * 2008 David Teller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version, * with the special exception on linking described in file LICENSE. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) module BaseBool : BatNumber.NUMERIC_BASE with type t = bool = struct type t = bool external not : bool -> bool = "%boolnot" (** The boolean negation. *) external ( && ) : bool -> bool -> bool = "%sequand" (** The boolean ``and''. Evaluation is sequential, left-to-right: in [e1 && e2], [e1] is evaluated first, and if it returns [false], [e2] is not evaluated at all. *) external ( || ) : bool -> bool -> bool = "%sequor" (** The boolean ``or''. Evaluation is sequential, left-to-right: in [e1 || e2], [e1] is evaluated first, and if it returns [true], [e2] is not evaluated at all. *) let zero, one = false, true let neg = not let succ _ = true let pred _ = false let abs x = x let add = ( || ) let mul = ( && ) let sub _ = not (*Weird extrapolation*) let div _ _= invalid_arg "Bool.div" let modulo _ _ = invalid_arg "Bool.modulo" let pow _ _ = invalid_arg "Bool.pow" let compare = compare let of_int = function | 0 -> false | _ -> true let to_int = function | false -> 0 | true -> 1 let of_float x = of_int (int_of_float x) let to_float x = float_of_int (to_int x) let of_string = function | "true" | "tt" | "1" -> true | "false"| "ff" | "0" -> false | _ -> invalid_arg "Bool.of_string" let to_string = string_of_bool end include BatNumber.MakeNumeric(BaseBool) (*$T succ succ true = true succ false = true *) (*$T pred pred true = false pred false = false *) (*$T abs abs true = true abs false = false *) (*$T sub sub true true = false sub true false = true sub false true = false sub false false = true *) (*$Q of_int (Q.int) (fun i -> (of_int i) = (Int.(<>) i 0)) *) (*$T of_int of_int 0 = false *) (*$T of_float (-1.) = true of_float 0. = false of_float nan = false to_float true = 1. to_float false = 0. of_string "true" = true of_string "false" = false try ignore (of_string "smurf"); false with Invalid_argument _ -> true *) external not : bool -> bool = "%boolnot" external ( && ) : bool -> bool -> bool = "%sequand" external ( || ) : bool -> bool -> bool = "%sequor" type bounded = t let min_num, max_num = false, true let print out t = BatInnerIO.nwrite out (to_string t) (*$T BatIO.to_string print true = "true" BatIO.to_string print false = "false" *)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>