From 672109de5456aa6ae6c2c30722c23f08da517309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Fri, 23 Feb 2018 13:43:29 -0500 Subject: [PATCH] Alpha: more intuitive `Misc.(-->)` --- src/proto_alpha/lib_protocol/src/baking.ml | 2 +- src/proto_alpha/lib_protocol/src/misc.ml | 8 ++++---- src/proto_alpha/lib_protocol/src/misc.mli | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/proto_alpha/lib_protocol/src/baking.ml b/src/proto_alpha/lib_protocol/src/baking.ml index cb691db0f..c9a033336 100644 --- a/src/proto_alpha/lib_protocol/src/baking.ml +++ b/src/proto_alpha/lib_protocol/src/baking.ml @@ -169,7 +169,7 @@ let check_endorsements_rights c level slots = return delegate let paying_priorities c = - 0 --> Constants.first_free_baking_slot c + 0 --> (Constants.first_free_baking_slot c - 1) let bond_and_reward = match Tez.(Constants.baking_bond_cost +? Constants.baking_reward) with diff --git a/src/proto_alpha/lib_protocol/src/misc.ml b/src/proto_alpha/lib_protocol/src/misc.ml index cd06faf7c..6c8ad7951 100644 --- a/src/proto_alpha/lib_protocol/src/misc.ml +++ b/src/proto_alpha/lib_protocol/src/misc.ml @@ -11,13 +11,13 @@ type 'a lazyt = unit -> 'a type 'a lazy_list_t = LCons of 'a * ('a lazy_list_t tzresult Lwt.t lazyt) type 'a lazy_list = 'a lazy_list_t tzresult Lwt.t -let rec (-->) i j = (* [i; i+1; ...; j-1] *) - if Compare.Int.(i >= j) +let rec (-->) i j = (* [i; i+1; ...; j] *) + if Compare.Int.(i > j) then [] else i :: (succ i --> j) -let rec (--->) i j = (* [i; i+1; ...; j-1] *) - if Compare.Int32.(i >= j) +let rec (--->) i j = (* [i; i+1; ...; j] *) + if Compare.Int32.(i > j) then [] else i :: (Int32.succ i ---> j) diff --git a/src/proto_alpha/lib_protocol/src/misc.mli b/src/proto_alpha/lib_protocol/src/misc.mli index 04af3dfef..f646f2c57 100644 --- a/src/proto_alpha/lib_protocol/src/misc.mli +++ b/src/proto_alpha/lib_protocol/src/misc.mli @@ -13,7 +13,7 @@ type 'a lazyt = unit -> 'a type 'a lazy_list_t = LCons of 'a * ('a lazy_list_t tzresult Lwt.t lazyt) type 'a lazy_list = 'a lazy_list_t tzresult Lwt.t -(** Include lower bound, exclude upper bound *) +(** Include bounds *) val (-->) : int -> int -> int list val (--->) : Int32.t -> Int32.t -> Int32.t list