Am Montag, den 22.02.2016, 15:16 -0500 schrieb Chan Ngo: > Hi Milan, > > > thanks, I see what you mentioned with the “&&” operator. In fact, one > case the behavior as I wanted is in crypto primitive (we need > constant-time function to avoid time side-channel attack, for example, > give any input for comparing with the secret hash value with fixed > size, the time execution of comparing is constant. You can define an operator that behaves like this: let ( &&& ) p q = p && q There might be other functions whose run time varies with the input. E.g. (string) equality comes to my mind. Gerd > > Best, > Chan > > > On Feb 22, 2016, at 3:12 PM, Milan Stanojević > > wrote: > > > > Compiler short circuits && operator so your loop runs only til the > > first element that differs. If you swap the arguments to && you > > should get the behavior of visiting all elements (which is of course > > undesirable in practice) > > > > > > > > -- ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------