home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.programming      Programming issues that transcend langua      57,431 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 56,725 of 57,431   
   Julio Di Egidio to Tim Rentsch   
   Re: A little puzzle.   
   03 Dec 22 02:43:13   
   
   From: julio@diegidio.name   
      
   On Saturday, 3 December 2022 at 07:30:46 UTC+1, Tim Rentsch wrote:   
   > Ben Bacarisse  writes:   
      
   > For reference here is my earlier answer [with return type changed   
   > to 'bool']:   
   >   
   > bool   
   > is_circularly_between( T a, T b, T c ){   
   > return a <= c ? a <= b && b < c : a <= b || b < c;   
   > }   
      
   What mental gymnastics?  To begin with, that is just   
   a pain to read with those variables names plus their   
   unconventional order.  Written slightly better, that is:   
      
   bool is_circularly_between(T x, T lo, T hi){   
     return lo <= hi ? lo <= x && x < hi : lo <= x || x < hi;   
   }   
      
   That said, circular over what exactly?  Namely, define   
   constructors for T: how is someone, starting from the   
   usual machine types, supposed to get to calling your   
   function?  (Try and see what you cannot but end up   
   with: there are only two options...)   
      
   Julio   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca