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,674 of 57,431   
   Ben Bacarisse to Richard Heathfield   
   Re: A little puzzle.   
   24 Nov 22 14:59:08   
   
   From: ben.usenet@bsb.me.uk   
      
   Richard Heathfield  writes:   
      
   > On 24/11/2022 1:14 pm, Ben Bacarisse wrote:   
   >> Richard Heathfield  writes:   
   >>   
   >>> On 24/11/2022 12:06 am, Ben Bacarisse wrote:   
   >>>> Tim Rentsch  writes:   
   >>>>   
   >>>>> I think this problem would make a good interview question,   
   >>>>> provided care were taken to phrase it so the subtleties were   
   >>>>> still there, but possible points of confusion were reduced.   
   >>>>> Not that I know how to do that... :)   
   >>>> I didn't make a good job of presenting it.  It certainly didn't pique   
   >>>> anyone else's interest, but then comp.programming is not well populated.   
   >>>> One thing that struck me was that I had not come across this before.  I   
   >>>> was surprised that this was not one of those idioms that one absorbs   
   >>>> along the way.  I suppose it is of limited use.   
   >>>   
   >>> The trouble is that it comes across as "is y >= x and <= z?", which is   
   >>> about as simple as it gets.   
   >> I am saddened that you think I would have made a hash of that and amazed   
   >> that you could think I had never have come across such a thing   
   >> before. :-(   
   >   
   > Well, of course I don't think that. But that's how it reads, that's   
   > all. It couldn't be what you meant, but I'm not a mind reader.   
      
   I hope you can help me express it better.   
      
   >> I would have thought that   
   >>    "Consider any ordered measure that "wraps round" -- bearings in   
   >>    degrees, minutes in the hour, indeed hours in either the 12 or 24 hour   
   >>    clock."   
   >> might have suggested it was not any old start <= x < end problem.   
   >   
   > It suggested modulo to me.   
      
   That quote was from the first post -- the one that reads to you as if I   
   meant a plain start <= x < end.   
      
   >> How   
   >> would you have phrased it so as to avoid the confusion?   
   >   
   > That depends on what you mean, which is evidently now clear to others,   
   > but not yet to me.   
      
   There's only been one solution, so I'm not 100% anyone else knows what   
   the question was!   
      
   I'd like to find a way to pin it down in case I ever want to express the   
   problem to someone else.  The case in point related to timed events   
   where I only know the start and end minutes.  I needed to test if the   
   current time's minutes was in any of the events.  So if there were three   
   events running from   
      
      10 to 25,  30 to 50  and  55 to 05   
      
   minutes past the hour then at 15 past we are in event 1.  At 35 past we   
   are not in any event, and at 03 we are in event 3.   
      
   I really want to find a way of explaining this that avoids too many   
   specifics because any one case is likely to raise a lot of questions.   
   The generic part is that there is some measure, with a direction or   
   order, that wraps round, and we want to test for sub-ranges of that   
   measure.   
      
   --   
   Ben.   
      
   --- 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