Path: csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.programming Subject: Re: A little puzzle. Date: Thu, 24 Nov 2022 13:14:01 +0000 Organization: A noiseless patient Spider Lines: 37 Message-ID: <87edtsijfq.fsf@bsb.me.uk> References: <875yf8nijb.fsf@bsb.me.uk> <865yf79l66.fsf@linuxsc.com> <87wn7nj9mb.fsf@bsb.me.uk> <86sfi98xnx.fsf@linuxsc.com> <87leo1i5bo.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: reader01.eternal-september.org; posting-host="66cc716c1d8e20186aec3fe895a20c78"; logging-data="707126"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190FN6qe2Z5M+fSJXVTXPMFpReL0iFn168=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cancel-Lock: sha1:FpTucqhg6VRMLEsAVw8i2JUnIWc= sha1:xf8H+NeyxCc6AdfB0kG35QWyUy0= X-BSB-Auth: 1.f13169b0a21013a7078f.20221124131401GMT.87edtsijfq.fsf@bsb.me.uk Xref: csiph.com comp.programming:15956 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. :-( 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. How would you have phrased it so as to avoid the confusion? Anyway, the take-away is that the size of the range is not part of the problem and that no modulo operations are involved. I found that mildly interesting. -- Ben.