Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"Yes, and I feel bad about rendering their useless carci into dogfood..." -- Badger comics


devel / comp.programming / A little puzzle.

SubjectAuthor
* A little puzzle.Ben Bacarisse
+* A little puzzle.David Brown
|`* A little puzzle.Ben Bacarisse
| +* A little puzzle.David Brown
| |+* A little puzzle.Richard Heathfield
| ||`- A little puzzle.David Brown
| |`* A little puzzle.Ben Bacarisse
| | `* A little puzzle.David Brown
| |  `* A little puzzle.Ben Bacarisse
| |   `- A little puzzle.David Brown
| `* A little puzzle.David Brown
|  +- A little puzzle.Richard Heathfield
|  `- A little puzzle.Ben Bacarisse
+* A little puzzle.Tim Rentsch
|`* A little puzzle.Ben Bacarisse
| `- A little puzzle.Tim Rentsch
+* A little puzzle.Richard Heathfield
|`* A little puzzle.Ben Bacarisse
| +* A little puzzle.Paul N
| |`* A little puzzle.Tim Rentsch
| | `- A little puzzle.David Brown
| `- FFs [was Re: A little puzzle]Richard Harnden
`* A little puzzle.Tim Rentsch
 `- A little puzzle.Ben Bacarisse

1
A little puzzle.

<875yf8nijb.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3914&group=comp.programming#3914

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.programming
Subject: A little puzzle.
Date: Mon, 21 Nov 2022 20:45:28 +0000
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <875yf8nijb.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="0b7422340e19e32d781009d919f3c74c";
logging-data="4080626"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/RuDVKyH5s9ubgc/p4fzY4UjdqTBu3lDk="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:u3QW975An7QHYeA2FH2n8bZI0YA=
sha1:m7dUAoRQsbVq5fwoJAhMu5LT+kc=
X-BSB-Auth: 1.43e0cf8e8a758350a9ac.20221121204528GMT.875yf8nijb.fsf@bsb.me.uk
 by: Ben Bacarisse - Mon, 21 Nov 2022 20:45 UTC

I wonder if there are any real posters here? Let's see...

I came across a trivial programming task that must have been solved a
thousand times by other programmers, but it had never crossed my path
until yesterday. I must be feeling my age because I made a real hash of
tackling it at first. Anyway, I thought it might be of interest.

Consider any ordered measure that "wraps round" -- bearings in degrees,
minutes in the hour, indeed hours in either the 12 or 24 hour clock.
The problem is to determine if a given value is in the sub-range
specified by a start and an en value.

I was specifically concerned with integer values where the sub-range
includes the start value but excludes the end value.

Though I am not sure this merits the term "puzzle", I suggest that
solutions be posted with some spoiler protection. Do all the news
readers used by programmers (or ex programmers) all respect the presence
of a form-feed character...
.... like this? Because that's my favourite way, rather than posting
lots of dummy lines before the solution.

--
Ben.

Re: A little puzzle.

<tlgp7v$3sinl$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3915&group=comp.programming#3915

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Mon, 21 Nov 2022 22:06:07 +0100
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <tlgp7v$3sinl$1@dont-email.me>
References: <875yf8nijb.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 21 Nov 2022 21:06:07 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="33316b73f02e3cd04c1452fac68237a1";
logging-data="4082421"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+MsKs5r6JBW/Mv1dvR/Xmvdglwxdx9DJw="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.2.2
Cancel-Lock: sha1:fVssri4+u9NIeNPX8r9nMTyR7sI=
In-Reply-To: <875yf8nijb.fsf@bsb.me.uk>
Content-Language: en-GB
 by: David Brown - Mon, 21 Nov 2022 21:06 UTC

On 21/11/2022 21:45, Ben Bacarisse wrote:
> I wonder if there are any real posters here? Let's see...
>
> I came across a trivial programming task that must have been solved a
> thousand times by other programmers, but it had never crossed my path
> until yesterday. I must be feeling my age because I made a real hash of
> tackling it at first. Anyway, I thought it might be of interest.
>
> Consider any ordered measure that "wraps round" -- bearings in degrees,
> minutes in the hour, indeed hours in either the 12 or 24 hour clock.
> The problem is to determine if a given value is in the sub-range
> specified by a start and an en value.
>
> I was specifically concerned with integer values where the sub-range
> includes the start value but excludes the end value.
>
> Though I am not sure this merits the term "puzzle", I suggest that
> solutions be posted with some spoiler protection. Do all the news
> readers used by programmers (or ex programmers) all respect the presence
> of a form-feed character...
>
> ... like this? Because that's my favourite way, rather than posting
> lots of dummy lines before the solution.
>

Are there any restrictions, such as sticking to integers? The problem
becomes quite difficult if your measure is the reals in [0, 1) and your
"n" is, say, π/4...

Re: A little puzzle.

<87tu2sm2bg.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3916&group=comp.programming#3916

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Mon, 21 Nov 2022 21:21:07 +0000
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <87tu2sm2bg.fsf@bsb.me.uk>
References: <875yf8nijb.fsf@bsb.me.uk> <tlgp7v$3sinl$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader01.eternal-september.org; posting-host="0b7422340e19e32d781009d919f3c74c";
logging-data="4080626"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mvhEbisC1FH1GgIcOt+EWlx/nhTwWcbY="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:4j8ZRj4NeB40NmXvl1yEbgHQORs=
sha1:gEBdaqQn08ITOjYHqNSj8U/Ky7c=
X-BSB-Auth: 1.c11dc4831e48c83769e6.20221121212107GMT.87tu2sm2bg.fsf@bsb.me.uk
 by: Ben Bacarisse - Mon, 21 Nov 2022 21:21 UTC

David Brown <david.brown@hesbynett.no> writes:

> On 21/11/2022 21:45, Ben Bacarisse wrote:
>> I wonder if there are any real posters here? Let's see...
>> I came across a trivial programming task that must have been solved a
>> thousand times by other programmers, but it had never crossed my path
>> until yesterday. I must be feeling my age because I made a real hash of
>> tackling it at first. Anyway, I thought it might be of interest.
>> Consider any ordered measure that "wraps round" -- bearings in degrees,
>> minutes in the hour, indeed hours in either the 12 or 24 hour clock.
>> The problem is to determine if a given value is in the sub-range
>> specified by a start and an en value.
>> I was specifically concerned with integer values where the sub-range
>> includes the start value but excludes the end value.
>> Though I am not sure this merits the term "puzzle", I suggest that
>> solutions be posted with some spoiler protection. Do all the news
>> readers used by programmers (or ex programmers) all respect the presence
>> of a form-feed character...
>>
>> ... like this? Because that's my favourite way, rather than posting
>> lots of dummy lines before the solution.
>>
>
> Are there any restrictions, such as sticking to integers? The problem
> becomes quite difficult if your measure is the reals in [0, 1) and
> your "n" is, say, π/4...

I don't follow. What is "my" n? I did not mention an n.

I don't see why the problem can't be naturally extended to a circular
real interval [0, 1), subject to the fact that we'll use floating point
numbers for practical purposes. But I don't think this is what you were
talking about.

--
Ben.

Re: A little puzzle.

<86ilj7ahsv.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3917&group=comp.programming#3917

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Mon, 21 Nov 2022 17:39:44 -0800
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <86ilj7ahsv.fsf@linuxsc.com>
References: <875yf8nijb.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader01.eternal-september.org; posting-host="0b8f1b00ad451c4da87815129da31114";
logging-data="4122223"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+lmjQ9D1lUtHT+YK5Fm8zQauK4uB8fdPw="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:u4TUnODr55Suu55DAUwuvoPPp8M=
sha1:ps7xqSJfzrqxuw701/fRF2zaFLc=
 by: Tim Rentsch - Tue, 22 Nov 2022 01:39 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> I wonder if there are any real posters here? Let's see...
>
> I came across a trivial programming task that must have been solved a
> thousand times by other programmers, but it had never crossed my path
> until yesterday. I must be feeling my age because I made a real hash of
> tackling it at first. Anyway, I thought it might be of interest.
>
> Consider any ordered measure that "wraps round" -- bearings in degrees,
> minutes in the hour, indeed hours in either the 12 or 24 hour clock.
> The problem is to determine if a given value is in the sub-range
> specified by a start and an en value.
>
> I was specifically concerned with integer values where the sub-range
> includes the start value but excludes the end value.

The question I think you're asking is to write a function like this

/* is_circularly_between( a, b, c ) -
* 1 if b is circularly between a and c,
* 0 otherwise
* interval [ a, c ) is closed at the 'a' end, open at the 'c' end
*
* The parameters a, b, and c are all of a single type T,
* where T allows relational (ordering) comparisons.
*
* Assumes a, b, and c all have legitimate values.
*/

int
is_circularly_between( T a, T b, T c ){
/* to be determined */
}

with T being some integer type. Assuming this is right I have
written such a function (but am not posting it just yet).

> Though I am not sure this merits the term "puzzle", I suggest that
> solutions be posted with some spoiler protection.

That's good, thank you for the reminder.

> Do all the news
> readers used by programmers (or ex programmers) all respect the presence
> of a form-feed character...
> Next page...

Mine does, for some values of "respect". It does have the property
that it hides what follows.

Re: A little puzzle.

<tli0jj$25jq$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3918&group=comp.programming#3918

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 09:17:54 +0100
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <tli0jj$25jq$1@dont-email.me>
References: <875yf8nijb.fsf@bsb.me.uk> <tlgp7v$3sinl$1@dont-email.me>
<87tu2sm2bg.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 22 Nov 2022 08:17:55 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="f6dd6be597a36657552486283c84fce2";
logging-data="71290"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9FKFs+ZmdWdHrogFS/ADVtpKOcmwLUWM="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Cancel-Lock: sha1:qR3t3t1pmLnwaW7YsrKwnFxal5M=
In-Reply-To: <87tu2sm2bg.fsf@bsb.me.uk>
Content-Language: en-GB
 by: David Brown - Tue, 22 Nov 2022 08:17 UTC

On 21/11/2022 22:21, Ben Bacarisse wrote:
> David Brown <david.brown@hesbynett.no> writes:
>
>> On 21/11/2022 21:45, Ben Bacarisse wrote:
>>> I wonder if there are any real posters here? Let's see...
>>> I came across a trivial programming task that must have been solved a
>>> thousand times by other programmers, but it had never crossed my path
>>> until yesterday. I must be feeling my age because I made a real hash of
>>> tackling it at first. Anyway, I thought it might be of interest.
>>> Consider any ordered measure that "wraps round" -- bearings in degrees,
>>> minutes in the hour, indeed hours in either the 12 or 24 hour clock.
>>> The problem is to determine if a given value is in the sub-range
>>> specified by a start and an en value.
>>> I was specifically concerned with integer values where the sub-range
>>> includes the start value but excludes the end value.
>>> Though I am not sure this merits the term "puzzle", I suggest that
>>> solutions be posted with some spoiler protection. Do all the news
>>> readers used by programmers (or ex programmers) all respect the presence
>>> of a form-feed character...
>>>
>>> ... like this? Because that's my favourite way, rather than posting
>>> lots of dummy lines before the solution.
>>>

Thunderbird seems to respect it when showing the posts. I am not sure
of the most convenient way to add one. I'll try copy-and-pasting your
FF character...

>>>

Did that work?

>>
>> Are there any restrictions, such as sticking to integers? The problem
>> becomes quite difficult if your measure is the reals in [0, 1) and
>> your "n" is, say, π/4...
>
> I don't follow. What is "my" n? I did not mention an n.

You referred to a "start value" and an "en value". I like to use names,
so I'll call the "start value" "a", and use "n" for the "en value". So
as far as I understand it, you are asking for a function that takes an
input "x" and determines if there is an integer "i" such that

x ≡ a + i.n

where the congruence is over a "wrapping" set.

>
> I don't see why the problem can't be naturally extended to a circular
> real interval [0, 1), subject to the fact that we'll use floating point
> numbers for practical purposes. But I don't think this is what you were
> talking about.
>

Well, the point is if "being specifically concerned with integers" means
the puzzle is limited to integer ranges, or if that is just what you
were thinking about first. I suppose you /do/ mean sticking to
integers, because I'd be surprised if a solution were possible once you
bring arbitrary real numbers into it. That kind of mathematics leads to
things like the Banach-Tarski paradox, and watching far too many maths
Youtube videos...

Re: A little puzzle.

<tli0tl$26a9$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3919&group=comp.programming#3919

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 09:23:16 +0100
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <tli0tl$26a9$1@dont-email.me>
References: <875yf8nijb.fsf@bsb.me.uk> <tlgp7v$3sinl$1@dont-email.me>
<87tu2sm2bg.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 22 Nov 2022 08:23:17 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="f6dd6be597a36657552486283c84fce2";
logging-data="72009"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/zNsWx5bkfRLAfFqPfDaM1PhmGQB6SvK8="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Cancel-Lock: sha1:Satk/6yT1hrwwEBY77aOiwE3CNg=
In-Reply-To: <87tu2sm2bg.fsf@bsb.me.uk>
Content-Language: en-GB
 by: David Brown - Tue, 22 Nov 2022 08:23 UTC

On 21/11/2022 22:21, Ben Bacarisse wrote:
> David Brown <david.brown@hesbynett.no> writes:
>
>> On 21/11/2022 21:45, Ben Bacarisse wrote:
>>> I wonder if there are any real posters here? Let's see...
>>> I came across a trivial programming task that must have been solved a
>>> thousand times by other programmers, but it had never crossed my path
>>> until yesterday. I must be feeling my age because I made a real hash of
>>> tackling it at first. Anyway, I thought it might be of interest.
>>> Consider any ordered measure that "wraps round" -- bearings in degrees,
>>> minutes in the hour, indeed hours in either the 12 or 24 hour clock.
>>> The problem is to determine if a given value is in the sub-range
>>> specified by a start and an en value.
>>> I was specifically concerned with integer values where the sub-range
>>> includes the start value but excludes the end value.
>>> Though I am not sure this merits the term "puzzle", I suggest that
>>> solutions be posted with some spoiler protection. Do all the news
>>> readers used by programmers (or ex programmers) all respect the presence
>>> of a form-feed character...
>>>
>>> ... like this? Because that's my favourite way, rather than posting
>>> lots of dummy lines before the solution.
>>>
>>
>> Are there any restrictions, such as sticking to integers? The problem
>> becomes quite difficult if your measure is the reals in [0, 1) and
>> your "n" is, say, π/4...
>
> I don't follow. What is "my" n? I did not mention an n.
>
> I don't see why the problem can't be naturally extended to a circular
> real interval [0, 1), subject to the fact that we'll use floating point
> numbers for practical purposes. But I don't think this is what you were
> talking about.
>

Having now read Tim's post, I see I might have /completely/
misinterpreted what you wrote. Your "en value" was not a step size "n",
but a typo for "end value". But then your problem comes down to nothing
more than a "modulo" function and a comparison, which sounds far too
simple a "puzzle".

Re: A little puzzle.

<tliab3$3pa84$6@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3920&group=comp.programming#3920

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rjh@cpax.org.uk (Richard Heathfield)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 11:04:03 +0000
Organization: Fix this later
Lines: 72
Message-ID: <tliab3$3pa84$6@dont-email.me>
References: <875yf8nijb.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 22 Nov 2022 11:04:03 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="30d916d4c1b9e1e71299a42b676cb8c4";
logging-data="3975428"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/rZfYAbJu7XjzoVDctKW3121PxpwNkzPQ3VymxKsjIlA=="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Cancel-Lock: sha1:N0bUEutpdrkAhOGarFgqoimgr2k=
In-Reply-To: <875yf8nijb.fsf@bsb.me.uk>
Content-Language: en-GB
 by: Richard Heathfield - Tue, 22 Nov 2022 11:04 UTC

On 21/11/2022 8:45 pm, Ben Bacarisse wrote:
> I wonder if there are any real posters here?

Nobody here but us chickens.

> Let's see...
>
> I came across a trivial programming task that must have been solved a
> thousand times by other programmers, but it had never crossed my path
> until yesterday. I must be feeling my age because I made a real hash of
> tackling it at first. Anyway, I thought it might be of interest.
>
> Consider any ordered measure that "wraps round" -- bearings in degrees,
> minutes in the hour, indeed hours in either the 12 or 24 hour clock.
> The problem is to determine if a given value is in the sub-range
> specified by a start and an en value.
>
> I was specifically concerned with integer values where the sub-range
> includes the start value but excludes the end value.
>
> Though I am not sure this merits the term "puzzle", I suggest that
> solutions be posted with some spoiler protection. Do all the news
> readers used by programmers (or ex programmers) all respect the presence
> of a form-feed character...

Dunno. Let's find out:

Ctrl-L coming up:

> ... like this? Because that's my favourite way, rather than posting
> lots of dummy lines before the solution.

Your problem is closely related to the very first question I was
ever posed (in early 1982), by a friend who needed to be able to
establish cleanly in a single expression whether a keypress was a
digit (ASCII 48-57). The relevant dialect of BASIC didn't have
anything like an isdigit function.

The friend was on the point of giving up on me when I handed him

ABS(K-52.5)<4.5

Nowadays we might render this in C as:

int inrange(int lo, int hi, int k)
{ return (k-(lo+hi)/2)<((hi-lo)/2);
}

although of course in C the problem would be far better solved as:

int inrange(int lo, int hi, int k)
{ return (lo <= k) && (k < hi);
}

or even as a macro.

I must confess I'm not entirely certain I have correctly
interpreted your puzzle, which I have taken to mean "is this a
given value in the given range", but this seems just a bit too
easy for you to make a hash of, but I'm sure I've made hashes of
worse. I've missed something, haven't I?

--
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

Re: A little puzzle.

<tliagn$3pa84$7@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3921&group=comp.programming#3921

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rjh@cpax.org.uk (Richard Heathfield)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 11:07:03 +0000
Organization: Fix this later
Lines: 32
Message-ID: <tliagn$3pa84$7@dont-email.me>
References: <875yf8nijb.fsf@bsb.me.uk> <tlgp7v$3sinl$1@dont-email.me>
<87tu2sm2bg.fsf@bsb.me.uk> <tli0jj$25jq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 22 Nov 2022 11:07:03 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="30d916d4c1b9e1e71299a42b676cb8c4";
logging-data="3975428"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jDPTrptoDLTKnayKhO0vqUmhhWho4EcJXa7s9EKw3GA=="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Cancel-Lock: sha1:+eC8rLXCCs01OWI3EPFHROuf0u4=
In-Reply-To: <tli0jj$25jq$1@dont-email.me>
Content-Language: en-GB
 by: Richard Heathfield - Tue, 22 Nov 2022 11:07 UTC

On 22/11/2022 8:17 am, David Brown wrote:
> On 21/11/2022 22:21, Ben Bacarisse wrote:
>> David Brown <david.brown@hesbynett.no> writes:
>>
>>> On 21/11/2022 21:45, Ben Bacarisse wrote:
>>>> Do all the
>>>> news
>>>> readers used by programmers (or ex programmers) all respect
>>>> the presence
>>>> of a form-feed character...
>>>>
>>>> ... like this?  Because that's my favourite way, rather than
>>>> posting
>>>> lots of dummy lines before the solution.
>>>>
>
> Thunderbird seems to respect it when showing the posts.  I am not
> sure of the most convenient way to add one.  I'll try
> copy-and-pasting your FF character...
>
> >>>
>
> Did that work?

The answer "no" springs to mind.

--
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

Re: A little puzzle.

<tliaih$3pa84$8@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3922&group=comp.programming#3922

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rjh@cpax.org.uk (Richard Heathfield)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 11:08:01 +0000
Organization: Fix this later
Lines: 12
Message-ID: <tliaih$3pa84$8@dont-email.me>
References: <875yf8nijb.fsf@bsb.me.uk> <tlgp7v$3sinl$1@dont-email.me>
<87tu2sm2bg.fsf@bsb.me.uk> <tli0tl$26a9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 22 Nov 2022 11:08:01 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="30d916d4c1b9e1e71299a42b676cb8c4";
logging-data="3975428"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kyYz7eY6pjPvXKFSXcamCg1+xwKwl8XaWYQ6excYs2A=="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Cancel-Lock: sha1:DVdwq3J66M4/trtelYy/7jg7JfI=
In-Reply-To: <tli0tl$26a9$1@dont-email.me>
Content-Language: en-GB
 by: Richard Heathfield - Tue, 22 Nov 2022 11:08 UTC

On 22/11/2022 8:23 am, David Brown wrote:
> But then your problem comes down to nothing more than a "modulo"
> function and a comparison, which sounds far too simple a "puzzle".

That's where I ended up too.

--
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

Re: A little puzzle.

<87tu2rkyjp.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3923&group=comp.programming#3923

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 11:40:10 +0000
Organization: A noiseless patient Spider
Lines: 84
Message-ID: <87tu2rkyjp.fsf@bsb.me.uk>
References: <875yf8nijb.fsf@bsb.me.uk> <tlgp7v$3sinl$1@dont-email.me>
<87tu2sm2bg.fsf@bsb.me.uk> <tli0jj$25jq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader01.eternal-september.org; posting-host="9b85f22d308ce2c1806d1ce4165d5a1d";
logging-data="98389"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+EtLi5bPFZ2aPWbClNjseUoZSe/V85kME="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:uV3I7ZfoUV3oAp9jijcDP+KkuKk=
sha1:bVLhh8pW+veXBoxYP8HhLm7VIcI=
X-BSB-Auth: 1.7de0d4e19b5cf8a088ee.20221122114010GMT.87tu2rkyjp.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 22 Nov 2022 11:40 UTC

David Brown <david.brown@hesbynett.no> writes:

> On 21/11/2022 22:21, Ben Bacarisse wrote:
>> David Brown <david.brown@hesbynett.no> writes:
>>
>>> On 21/11/2022 21:45, Ben Bacarisse wrote:
>>>> I wonder if there are any real posters here? Let's see...
>>>> I came across a trivial programming task that must have been solved a
>>>> thousand times by other programmers, but it had never crossed my path
>>>> until yesterday. I must be feeling my age because I made a real hash of
>>>> tackling it at first. Anyway, I thought it might be of interest.
>>>> Consider any ordered measure that "wraps round" -- bearings in degrees,
>>>> minutes in the hour, indeed hours in either the 12 or 24 hour clock.
>>>> The problem is to determine if a given value is in the sub-range
>>>> specified by a start and an en value.
>>>> I was specifically concerned with integer values where the sub-range
>>>> includes the start value but excludes the end value.
>>>> Though I am not sure this merits the term "puzzle", I suggest that
>>>> solutions be posted with some spoiler protection. Do all the news
>>>> readers used by programmers (or ex programmers) all respect the presence
>>>> of a form-feed character...
>>>>
>>>> ... like this? Because that's my favourite way, rather than posting
>>>> lots of dummy lines before the solution.
>>>>
>
> Thunderbird seems to respect it when showing the posts. I am not sure of the most convenient way to add one. I'll try copy-and-pasting your
> FF character...
>
>>>>
>
> Did that work?

Yes, but for my newsreader a form feed only hides what's below it when
at the start of a line.

>>> Are there any restrictions, such as sticking to integers? The problem
>>> becomes quite difficult if your measure is the reals in [0, 1) and
>>> your "n" is, say, π/4...
>> I don't follow. What is "my" n? I did not mention an n.
>
> You referred to a "start value" and an "en value".

Sorry, typo. End value.

> I like to use names, so I'll call the "start value" "a", and use "n"
> for the "en value". So as far as I understand it, you are asking for
> a function that takes an input "x" and determines if there is an
> integer "i" such that
>
> x ≡ a + i.n
>
> where the congruence is over a "wrapping" set.

Hmm... I must have made a real hash of the description (and I was being
deliberately a bit vague for reasons that should come out later) because
there is always such an i.

Here's an example. An event starts at 5 minutes to the hour (start =
55) and ends at quarter past (end = 15). The x's 55, 58, 3, 12 and so
on are in the range, 53, 17 and 33 are not.

The fact that all data are integers is not really material. We could
consider compass points in [0, 2*pi) and have arbitrary start and end
bearings.

>> I don't see why the problem can't be naturally extended to a circular
>> real interval [0, 1), subject to the fact that we'll use floating point
>> numbers for practical purposes. But I don't think this is what you were
>> talking about.
>
> Well, the point is if "being specifically concerned with integers"
> means the puzzle is limited to integer ranges, or if that is just what
> you were thinking about first. I suppose you /do/ mean sticking to
> integers, because I'd be surprised if a solution were possible once
> you bring arbitrary real numbers into it. That kind of mathematics
> leads to things like the Banach-Tarski paradox, and watching far too
> many maths Youtube videos...

I think I've not explained the problem well because there's not that
rarefied about it!

--
Ben.

Re: A little puzzle.

<87leo3kv55.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3924&group=comp.programming#3924

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 12:53:42 +0000
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <87leo3kv55.fsf@bsb.me.uk>
References: <875yf8nijb.fsf@bsb.me.uk> <tliab3$3pa84$6@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="9b85f22d308ce2c1806d1ce4165d5a1d";
logging-data="114436"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/YyL5O36J2skZ0SX8KaDsUnuEUFinfIYw="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:tLaPE5hB7MHP8wNFaogWTUL5qow=
sha1:vPDRrL3/I7t+n6Cj5khejkTdhIA=
X-BSB-Auth: 1.b1e91328ea38986ff252.20221122125342GMT.87leo3kv55.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 22 Nov 2022 12:53 UTC

Richard Heathfield <rjh@cpax.org.uk> writes:

> On 21/11/2022 8:45 pm, Ben Bacarisse wrote:
>> I wonder if there are any real posters here?
>
> Nobody here but us chickens.
>
>> Let's see...
>> I came across a trivial programming task that must have been solved a
>> thousand times by other programmers, but it had never crossed my path
>> until yesterday. I must be feeling my age because I made a real hash of
>> tackling it at first. Anyway, I thought it might be of interest.
>> Consider any ordered measure that "wraps round" -- bearings in degrees,
>> minutes in the hour, indeed hours in either the 12 or 24 hour clock.
>> The problem is to determine if a given value is in the sub-range
>> specified by a start and an en value.
>> I was specifically concerned with integer values where the sub-range
>> includes the start value but excludes the end value.
>> Though I am not sure this merits the term "puzzle", I suggest that
>> solutions be posted with some spoiler protection. Do all the news
>> readers used by programmers (or ex programmers) all respect the presence
>> of a form-feed character...
>
> Dunno. Let's find out:
>
> Ctrl-L coming up:
>
>
>

Didn't see a form feed there. Here's one (I hope):

> although of course in C the problem would be far better solved as:
>
> int inrange(int lo, int hi, int k)
> {
> return (lo <= k) && (k < hi);
> }
>
> or even as a macro.
>
> I must confess I'm not entirely certain I have correctly interpreted
> your puzzle, which I have taken to mean "is this a given value in the
> given range", but this seems just a bit too easy for you to make a
> hash of, but I'm sure I've made hashes of worse. I've missed
> something, haven't I?

The circular wrapping. On a clock, 55 is in the range of minutes that
starts at 45 and ends at 5.

--
Ben.

Re: A little puzzle.

<87fsebkv39.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3925&group=comp.programming#3925

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 12:54:50 +0000
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <87fsebkv39.fsf@bsb.me.uk>
References: <875yf8nijb.fsf@bsb.me.uk> <tlgp7v$3sinl$1@dont-email.me>
<87tu2sm2bg.fsf@bsb.me.uk> <tli0tl$26a9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader01.eternal-september.org; posting-host="9b85f22d308ce2c1806d1ce4165d5a1d";
logging-data="114436"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mA2VtpUjqANixBY5sVPKDYZMzmMwhR7Y="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:S+d95kLQVLBqMU1mIyFggq4uNik=
sha1:XEfLBpg8VpK0DNYVWUdE7sYXW+Y=
X-BSB-Auth: 1.387074027fac4496e015.20221122125450GMT.87fsebkv39.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 22 Nov 2022 12:54 UTC

David Brown <david.brown@hesbynett.no> writes:

> On 21/11/2022 22:21, Ben Bacarisse wrote:
>> David Brown <david.brown@hesbynett.no> writes:
>>
>>> On 21/11/2022 21:45, Ben Bacarisse wrote:
>>>> I wonder if there are any real posters here? Let's see...
>>>> I came across a trivial programming task that must have been solved a
>>>> thousand times by other programmers, but it had never crossed my path
>>>> until yesterday. I must be feeling my age because I made a real hash of
>>>> tackling it at first. Anyway, I thought it might be of interest.
>>>> Consider any ordered measure that "wraps round" -- bearings in degrees,
>>>> minutes in the hour, indeed hours in either the 12 or 24 hour clock.
>>>> The problem is to determine if a given value is in the sub-range
>>>> specified by a start and an en value.
>>>> I was specifically concerned with integer values where the sub-range
>>>> includes the start value but excludes the end value.
>>>> Though I am not sure this merits the term "puzzle", I suggest that
>>>> solutions be posted with some spoiler protection. Do all the news
>>>> readers used by programmers (or ex programmers) all respect the presence
>>>> of a form-feed character...
>>>>
>>>> ... like this? Because that's my favourite way, rather than posting
>>>> lots of dummy lines before the solution.
>>>>
>>>
>>> Are there any restrictions, such as sticking to integers? The problem
>>> becomes quite difficult if your measure is the reals in [0, 1) and
>>> your "n" is, say, π/4...
>> I don't follow. What is "my" n? I did not mention an n.
>> I don't see why the problem can't be naturally extended to a circular
>> real interval [0, 1), subject to the fact that we'll use floating point
>> numbers for practical purposes. But I don't think this is what you were
>> talking about.
>
> Having now read Tim's post, I see I might have /completely/
> misinterpreted what you wrote. Your "en value" was not a step size
> "n", but a typo for "end value". But then your problem comes down to
> nothing more than a "modulo" function and a comparison, which sounds
> far too simple a "puzzle".

What's your solution?

--
Ben.

Re: A little puzzle.

<87a64jkut1.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3926&group=comp.programming#3926

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 13:00:58 +0000
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <87a64jkut1.fsf@bsb.me.uk>
References: <875yf8nijb.fsf@bsb.me.uk> <86ilj7ahsv.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="9b85f22d308ce2c1806d1ce4165d5a1d";
logging-data="114436"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/i/UVnxMJAI90WRLF9xN20GVyiNWdNWx8="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:66hdvGcHl2PHycA7w/+u2/0yvy4=
sha1:4aooM4XIAzXpXe7U6n7t/Nnraa4=
X-BSB-Auth: 1.37d09d7bf9f7d6d7bc15.20221122130058GMT.87a64jkut1.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 22 Nov 2022 13:00 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

> The question I think you're asking is to write a function like this

Yes, but I deliberately did not present the question with this degree of
clarity! I wanted to present the problem as I came across it because
what little fun it offers comes from clarifying the issue.

>> Though I am not sure this merits the term "puzzle", I suggest that
>> solutions be posted with some spoiler protection.
>
> That's good, thank you for the reminder.

Your explanation of the issue is, to my mind, a teeny tiny spoiler put
"above the fold".

>> Do all the news
>> readers used by programmers (or ex programmers) all respect the presence
>> of a form-feed character...
>> Next page...
>
> Mine does, for some values of "respect". It does have the property
> that it hides what follows.

Yes. In the old days (which is only the late 80s in this case) I think
all newsreaders would require some action to see that part of a message
after a form feed, so that was how spoilers were put "below the fold".

--
Ben.

Re: A little puzzle.

<4f03335d-63ca-447b-b538-dd8a59c11fa9n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3927&group=comp.programming#3927

  copy link   Newsgroups: comp.programming
X-Received: by 2002:a05:6214:2d47:b0:4bd:f65a:4742 with SMTP id na7-20020a0562142d4700b004bdf65a4742mr6365952qvb.36.1669122083894;
Tue, 22 Nov 2022 05:01:23 -0800 (PST)
X-Received: by 2002:a05:620a:13ef:b0:6fa:2cc3:b39e with SMTP id
h15-20020a05620a13ef00b006fa2cc3b39emr4518862qkl.579.1669122083734; Tue, 22
Nov 2022 05:01:23 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.programming
Date: Tue, 22 Nov 2022 05:01:23 -0800 (PST)
In-Reply-To: <87leo3kv55.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=89.240.148.241; posting-account=0B-afgoAAABP6274zLUJKa8ZpdIdhsYx
NNTP-Posting-Host: 89.240.148.241
References: <875yf8nijb.fsf@bsb.me.uk> <tliab3$3pa84$6@dont-email.me> <87leo3kv55.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4f03335d-63ca-447b-b538-dd8a59c11fa9n@googlegroups.com>
Subject: Re: A little puzzle.
From: gw7rib@aol.com (Paul N)
Injection-Date: Tue, 22 Nov 2022 13:01:23 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3447
 by: Paul N - Tue, 22 Nov 2022 13:01 UTC

On Tuesday, November 22, 2022 at 12:53:47 PM UTC, Ben Bacarisse wrote:
> Richard Heathfield <r...@cpax.org.uk> writes:
>
> > On 21/11/2022 8:45 pm, Ben Bacarisse wrote:
> >> I wonder if there are any real posters here?
> >
> > Nobody here but us chickens.
> >
> >> Let's see...
> >> I came across a trivial programming task that must have been solved a
> >> thousand times by other programmers, but it had never crossed my path
> >> until yesterday. I must be feeling my age because I made a real hash of
> >> tackling it at first. Anyway, I thought it might be of interest.
> >> Consider any ordered measure that "wraps round" -- bearings in degrees,
> >> minutes in the hour, indeed hours in either the 12 or 24 hour clock.
> >> The problem is to determine if a given value is in the sub-range
> >> specified by a start and an en value.
> >> I was specifically concerned with integer values where the sub-range
> >> includes the start value but excludes the end value.
> >> Though I am not sure this merits the term "puzzle", I suggest that
> >> solutions be posted with some spoiler protection. Do all the news
> >> readers used by programmers (or ex programmers) all respect the presence
> >> of a form-feed character...
> >
> > Dunno. Let's find out:
> >
> > Ctrl-L coming up:
> >
> >
> >
> Didn't see a form feed there. Here's one (I hope):
> > although of course in C the problem would be far better solved as:
> >
> > int inrange(int lo, int hi, int k)
> > {
> > return (lo <= k) && (k < hi);
> > }
> >
> > or even as a macro.
> >
> > I must confess I'm not entirely certain I have correctly interpreted
> > your puzzle, which I have taken to mean "is this a given value in the
> > given range", but this seems just a bit too easy for you to make a
> > hash of, but I'm sure I've made hashes of worse. I've missed
> > something, haven't I?
> The circular wrapping. On a clock, 55 is in the range of minutes that
> starts at 45 and ends at 5.

What's wrong with - subtract start from both end and value, add the modulus if either is negative, and compare?

For example, in your example we subtract 45 from 5 (end) and 55 (value) to get -40 (end) and 10 (value). Adjusting gives 20 (end) and 10 (value). 10 is below 20 so we're in the range.

Re: A little puzzle.

<865yf79l66.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3928&group=comp.programming#3928

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 05:24:33 -0800
Organization: A noiseless patient Spider
Lines: 91
Message-ID: <865yf79l66.fsf@linuxsc.com>
References: <875yf8nijb.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader01.eternal-september.org; posting-host="0b8f1b00ad451c4da87815129da31114";
logging-data="119594"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qTwT722uf0oYdMk8LbU1ClBbfKAk51Uk="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:ueadR6IjxUJxhrnT0icEZmHTW8E=
sha1:qoMp7DJRM5kIUWet98Wk2lCaNqQ=
 by: Tim Rentsch - Tue, 22 Nov 2022 13:24 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

[...]

> Consider any ordered measure that "wraps round" -- bearings in degrees,
> minutes in the hour, indeed hours in either the 12 or 24 hour clock.
> The problem is to determine if a given value is in the sub-range
> specified by a start and an [end] value.
>
> I was specifically concerned with integer values where the sub-range
> includes the start value but excludes the end value.
>
> Though I am not sure this merits the term "puzzle", I suggest that
> solutions be posted with some spoiler protection.

My answer below (forgive me for resorting to "low tech" spoiler
protection)...

(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)
(spoiler alert)

/* is_circularly_between( a, b, c ) -
* 1 if b is circularly between a and c,
* 0 otherwise
* the interval of interest [ a, c ) is understood to be
* closed at the 'a' end, and
* open at the 'c' end
*
* The parameters a, b, and c are all of a single type T,
* where T allows relational (ordering) comparisons.
*
* Assumes a, b, and c all have legitimate values.
*/

int
is_circularly_between( T a, T b, T c ){
return a <= c ? a <= b && b < c : a <= b || b < c;
}

This function works if T is any integer type, or any real
floating-point type, or is a type pointer to any complete
object type. (Disclaimer: I didn't think carefully about
the case where T is a pointer to an array type.)

Re: A little puzzle.

<861qpv9kts.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3929&group=comp.programming#3929

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 05:31:59 -0800
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <861qpv9kts.fsf@linuxsc.com>
References: <875yf8nijb.fsf@bsb.me.uk> <86ilj7ahsv.fsf@linuxsc.com> <87a64jkut1.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader01.eternal-september.org; posting-host="0b8f1b00ad451c4da87815129da31114";
logging-data="119594"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mHW7JKc9zeCdwYvmP2C7dZiczy2IDqtE="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:UKR99YzY+yEMATStehTD1aWOmoU=
sha1:tggkchzuN929QEQOvPqCSWXk8Zs=
 by: Tim Rentsch - Tue, 22 Nov 2022 13:31 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> The question I think you're asking is to write a function like this
>
> Yes, but I deliberately did not present the question with this degree of
> clarity! I wanted to present the problem as I came across it because
> what little fun it offers comes from clarifying the issue.

Ah ha. I didn't understand that before.

>>> Though I am not sure this merits the term "puzzle", I suggest that
>>> solutions be posted with some spoiler protection.
>>
>> That's good, thank you for the reminder.
>
> Your explanation of the issue is, to my mind, a teeny tiny spoiler put
> "above the fold".

Yes, I realized that only later and after the fact. My apologies.

Re: A little puzzle.

<86wn7n85i6.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3930&group=comp.programming#3930

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 05:48:17 -0800
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <86wn7n85i6.fsf@linuxsc.com>
References: <875yf8nijb.fsf@bsb.me.uk> <tliab3$3pa84$6@dont-email.me> <87leo3kv55.fsf@bsb.me.uk> <4f03335d-63ca-447b-b538-dd8a59c11fa9n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader01.eternal-september.org; posting-host="0b8f1b00ad451c4da87815129da31114";
logging-data="119594"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jlytV0jOt1kHWEN5jUN3f8oGH64lPQcs="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:j0AK6gXKWpDmHE6bxR1TQ5TdPDI=
sha1:8SjXV1b0aVXMDScrn8Bw8gOFfIE=
 by: Tim Rentsch - Tue, 22 Nov 2022 13:48 UTC

Paul N <gw7rib@aol.com> writes:

> On Tuesday, November 22, 2022 at 12:53:47 PM UTC, Ben Bacarisse wrote:
>
>> Richard Heathfield <r...@cpax.org.uk> writes:

[...]

>>> although of course in C the problem would be far better solved as:
>>>
>>> int inrange(int lo, int hi, int k)
>>> {
>>> return (lo <= k) && (k < hi);
>>> }
>>>
>>> or even as a macro.
>>>
>>> I must confess I'm not entirely certain I have correctly interpreted
>>> your puzzle, which I have taken to mean "is this a given value in the
>>> given range", but this seems just a bit too easy for you to make a
>>> hash of, but I'm sure I've made hashes of worse. I've missed
>>> something, haven't I?
>>
>> The circular wrapping. On a clock, 55 is in the range of minutes that
>> starts at 45 and ends at 5.
>
> What's wrong with - subtract start from both end and value, add the
> modulus if either is negative, and compare?

Suppose start is 9223372036854775800 and end is -9223372036854775800
(or the corresponding values for type 'int', those values are for a
64-bit signed integer type). The subtraction gives undefined behavior.

Re: A little puzzle.

<tlilld$3sro$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3931&group=comp.programming#3931

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 15:17:16 +0100
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <tlilld$3sro$1@dont-email.me>
References: <875yf8nijb.fsf@bsb.me.uk> <tlgp7v$3sinl$1@dont-email.me>
<87tu2sm2bg.fsf@bsb.me.uk> <tli0jj$25jq$1@dont-email.me>
<tliagn$3pa84$7@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 22 Nov 2022 14:17:17 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="f6dd6be597a36657552486283c84fce2";
logging-data="127864"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+GZLvkL69j53cSVf77vh/Nsborpjd58DQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Cancel-Lock: sha1:/qfJt0lxXWW2uMj2dhlkbZE54fc=
Content-Language: en-GB
In-Reply-To: <tliagn$3pa84$7@dont-email.me>
 by: David Brown - Tue, 22 Nov 2022 14:17 UTC

On 22/11/2022 12:07, Richard Heathfield wrote:
> On 22/11/2022 8:17 am, David Brown wrote:
>> On 21/11/2022 22:21, Ben Bacarisse wrote:
>>> David Brown <david.brown@hesbynett.no> writes:
>>>
>>>> On 21/11/2022 21:45, Ben Bacarisse wrote:
>>>>> Do all the news
>>>>> readers used by programmers (or ex programmers) all respect the
>>>>> presence
>>>>> of a form-feed character...
>>>>>
>>>>> ... like this?  Because that's my favourite way, rather than posting
>>>>> lots of dummy lines before the solution.
>>>>>
>>
>> Thunderbird seems to respect it when showing the posts.  I am not sure
>> of the most convenient way to add one.  I'll try copy-and-pasting your
>> FF character...
>>
>>  >>>
>>
>> Did that work?
>
> The answer "no" springs to mind.
>

It worked fine for me, in the sense that regardless of the size of the
Thunderbird window used to view the message, everything after each FF
was just beyond view until I scrolled down. When replying to the
message, Thunderbird compacts it all.

What happens in your newsreader? You also have Thunderbird, albeit a
slightly newer version than mine.

But for Ben's newsreader to be happy, it seems the FF needs to be at the
start of a line.

Re: A little puzzle.

<tlim77$3u8n$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3932&group=comp.programming#3932

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 15:26:46 +0100
Organization: A noiseless patient Spider
Lines: 71
Message-ID: <tlim77$3u8n$1@dont-email.me>
References: <875yf8nijb.fsf@bsb.me.uk> <tlgp7v$3sinl$1@dont-email.me>
<87tu2sm2bg.fsf@bsb.me.uk> <tli0jj$25jq$1@dont-email.me>
<87tu2rkyjp.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 22 Nov 2022 14:26:47 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="f6dd6be597a36657552486283c84fce2";
logging-data="129303"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ONQFun2BBvMAlgf2Z70VtNgsIe72gvOI="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Cancel-Lock: sha1:0oUIx2YMl8aGmmB5hk8MCyAKE9I=
Content-Language: en-GB
In-Reply-To: <87tu2rkyjp.fsf@bsb.me.uk>
 by: David Brown - Tue, 22 Nov 2022 14:26 UTC

On 22/11/2022 12:40, Ben Bacarisse wrote:
> David Brown <david.brown@hesbynett.no> writes:
>
>> On 21/11/2022 22:21, Ben Bacarisse wrote:
>>> David Brown <david.brown@hesbynett.no> writes:
>>>

(We don't need secrets here, I think, so I'll snip the FF's.)

>>>> Are there any restrictions, such as sticking to integers? The problem
>>>> becomes quite difficult if your measure is the reals in [0, 1) and
>>>> your "n" is, say, π/4...
>>> I don't follow. What is "my" n? I did not mention an n.
>>
>> You referred to a "start value" and an "en value".
>
> Sorry, typo. End value.
>
>> I like to use names, so I'll call the "start value" "a", and use "n"
>> for the "en value". So as far as I understand it, you are asking for
>> a function that takes an input "x" and determines if there is an
>> integer "i" such that
>>
>> x ≡ a + i.n
>>
>> where the congruence is over a "wrapping" set.
>
> Hmm... I must have made a real hash of the description (and I was being
> deliberately a bit vague for reasons that should come out later) because
> there is always such an i.

Maybe I had formed an impression of the problem too early, and
interpreted everything you wrote to fit that idea. Certainly for my
interpretation, there is not always such an "i". (For example, use
modulo 24, with a = 0, n = 4, and x = 1. No "i" can be found. It's all
about cyclic groups and subgroups. Since I have no doubt at all that
you know this, I assume I am misinterpreting you again :-) )

>
> Here's an example. An event starts at 5 minutes to the hour (start =
> 55) and ends at quarter past (end = 15). The x's 55, 58, 3, 12 and so
> on are in the range, 53, 17 and 33 are not.
>

OK. We are talking ranges, rather than points.

> The fact that all data are integers is not really material. We could
> consider compass points in [0, 2*pi) and have arbitrary start and end
> bearings.
>
>>> I don't see why the problem can't be naturally extended to a circular
>>> real interval [0, 1), subject to the fact that we'll use floating point
>>> numbers for practical purposes. But I don't think this is what you were
>>> talking about.
>>
>> Well, the point is if "being specifically concerned with integers"
>> means the puzzle is limited to integer ranges, or if that is just what
>> you were thinking about first. I suppose you /do/ mean sticking to
>> integers, because I'd be surprised if a solution were possible once
>> you bring arbitrary real numbers into it. That kind of mathematics
>> leads to things like the Banach-Tarski paradox, and watching far too
>> many maths Youtube videos...
>
> I think I've not explained the problem well because there's not that
> rarefied about it!
>

Surely it is not that unusual to enjoy things like this?

<https://www.youtube.com/watch?v=s86-Z-CbaHA>

Re: A little puzzle.

<tlimf9$3u8n$2@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3933&group=comp.programming#3933

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 15:31:05 +0100
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <tlimf9$3u8n$2@dont-email.me>
References: <875yf8nijb.fsf@bsb.me.uk> <tliab3$3pa84$6@dont-email.me>
<87leo3kv55.fsf@bsb.me.uk>
<4f03335d-63ca-447b-b538-dd8a59c11fa9n@googlegroups.com>
<86wn7n85i6.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 22 Nov 2022 14:31:05 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="f6dd6be597a36657552486283c84fce2";
logging-data="129303"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ljHKtq4tbi9W0HZP4zlVjP3lm4bFOtuw="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Cancel-Lock: sha1:PJT8/eLDU+XSQ9Z+iGGHjP82sHs=
Content-Language: en-GB
In-Reply-To: <86wn7n85i6.fsf@linuxsc.com>
 by: David Brown - Tue, 22 Nov 2022 14:31 UTC

On 22/11/2022 14:48, Tim Rentsch wrote:
> Paul N <gw7rib@aol.com> writes:
>
>> On Tuesday, November 22, 2022 at 12:53:47 PM UTC, Ben Bacarisse wrote:
>>
>>> Richard Heathfield <r...@cpax.org.uk> writes:
>
> [...]
>
>>>> although of course in C the problem would be far better solved as:
>>>>
>>>> int inrange(int lo, int hi, int k)
>>>> {
>>>> return (lo <= k) && (k < hi);
>>>> }
>>>>
>>>> or even as a macro.
>>>>
>>>> I must confess I'm not entirely certain I have correctly interpreted
>>>> your puzzle, which I have taken to mean "is this a given value in the
>>>> given range", but this seems just a bit too easy for you to make a
>>>> hash of, but I'm sure I've made hashes of worse. I've missed
>>>> something, haven't I?
>>>
>>> The circular wrapping. On a clock, 55 is in the range of minutes that
>>> starts at 45 and ends at 5.
>>
>> What's wrong with - subtract start from both end and value, add the
>> modulus if either is negative, and compare?
>
> Suppose start is 9223372036854775800 and end is -9223372036854775800
> (or the corresponding values for type 'int', those values are for a
> 64-bit signed integer type). The subtraction gives undefined behavior.

It's all modulo arithmetic - you can do it all as unsigned types.

Or use Python and be happy - this is, after all, comp.programming and
not comp.lang.c !

Re: A little puzzle.

<87wn7nj9mb.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3934&group=comp.programming#3934

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 15:23:56 +0000
Organization: A noiseless patient Spider
Lines: 110
Message-ID: <87wn7nj9mb.fsf@bsb.me.uk>
References: <875yf8nijb.fsf@bsb.me.uk> <865yf79l66.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="9b85f22d308ce2c1806d1ce4165d5a1d";
logging-data="138753"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+6LbJQCECWKjn0jxAJfZ1FLEwUiQqYXIE="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:NFFnKv8kRuzWbN8kIwMnn6J8s/I=
sha1:FjFnNbhAJK/r89AzPvzlnXtcGz8=
X-BSB-Auth: 1.1fefea753ed8551e544e.20221122152356GMT.87wn7nj9mb.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 22 Nov 2022 15:23 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>
> [...]
>
>> Consider any ordered measure that "wraps round" -- bearings in degrees,
>> minutes in the hour, indeed hours in either the 12 or 24 hour clock.
>> The problem is to determine if a given value is in the sub-range
>> specified by a start and an [end] value.
>>
>> I was specifically concerned with integer values where the sub-range
>> includes the start value but excludes the end value.
>>
>> Though I am not sure this merits the term "puzzle", I suggest that
>> solutions be posted with some spoiler protection.
>
> My answer below (forgive me for resorting to "low tech" spoiler
> protection)...

I think this is the safest option.

> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
> (spoiler alert)
>
> /* is_circularly_between( a, b, c ) -
> * 1 if b is circularly between a and c,
> * 0 otherwise
> * the interval of interest [ a, c ) is understood to be
> * closed at the 'a' end, and
> * open at the 'c' end
> *
> * The parameters a, b, and c are all of a single type T,
> * where T allows relational (ordering) comparisons.
> *
> * Assumes a, b, and c all have legitimate values.
> */
>
> int
> is_circularly_between( T a, T b, T c ){
> return a <= c ? a <= b && b < c : a <= b || b < c;
> }

I am sure you know this is correct! My version is recursive, because I
think it adds some clarity, but whether it really does add anything
probably depends on how one arrives at the answer.

bool is_circularly_between(T start, T end, T i) {
return start <= end ? start <= i && i < end
: !is_circularly_between(end, start, i);
}

(I put the parameters in a different order because I was using Haskell,
and with Curried functions, is_circularly_between x y is a useful
function in its own right.)

The only reason I thought it worth mentioning was my failure! For the
best part of an hour I thought the size of the circular range (the
modulus) had to be involved.

--
Ben.

Re: A little puzzle.

<87r0xvj9ea.fsf@bsb.me.uk>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3935&group=comp.programming#3935

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 15:28:45 +0000
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <87r0xvj9ea.fsf@bsb.me.uk>
References: <875yf8nijb.fsf@bsb.me.uk> <tlgp7v$3sinl$1@dont-email.me>
<87tu2sm2bg.fsf@bsb.me.uk> <tli0jj$25jq$1@dont-email.me>
<87tu2rkyjp.fsf@bsb.me.uk> <tlim77$3u8n$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="9b85f22d308ce2c1806d1ce4165d5a1d";
logging-data="138753"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+acE4+SE5srqK7IcC2570RCChkoJNEM0o="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:6wFu5oALBCijwPQwtOy2oOjvYag=
sha1:9oW8vRtQxelCIlwGC0q2LHal180=
X-BSB-Auth: 1.6df4f4f33ddae27c4ae3.20221122152845GMT.87r0xvj9ea.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 22 Nov 2022 15:28 UTC

David Brown <david.brown@hesbynett.no> writes:

> OK. We are talking ranges, rather than points.

Yes. So much confusion from a missing 'd'! Sorry.

--
Ben.

Re: A little puzzle.

<tlipvj$48av$2@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3936&group=comp.programming#3936

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.programming
Subject: Re: A little puzzle.
Date: Tue, 22 Nov 2022 16:30:59 +0100
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <tlipvj$48av$2@dont-email.me>
References: <875yf8nijb.fsf@bsb.me.uk> <tlgp7v$3sinl$1@dont-email.me>
<87tu2sm2bg.fsf@bsb.me.uk> <tli0jj$25jq$1@dont-email.me>
<87tu2rkyjp.fsf@bsb.me.uk> <tlim77$3u8n$1@dont-email.me>
<87r0xvj9ea.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 22 Nov 2022 15:30:59 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="f6dd6be597a36657552486283c84fce2";
logging-data="139615"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mtwVxXr0nn9AVLhnIEHITE1l2D/DK4lw="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Cancel-Lock: sha1:/mwTWmXDYBzo1RcuEIg8i5efafQ=
Content-Language: en-GB
In-Reply-To: <87r0xvj9ea.fsf@bsb.me.uk>
 by: David Brown - Tue, 22 Nov 2022 15:30 UTC

On 22/11/2022 16:28, Ben Bacarisse wrote:
> David Brown <david.brown@hesbynett.no> writes:
>
>> OK. We are talking ranges, rather than points.
>
> Yes. So much confusion from a missing 'd'! Sorry.
>

Yes, but it made the thread more fun!

FFs [was Re: A little puzzle]

<tlitd0$4c5i$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=3937&group=comp.programming#3937

  copy link   Newsgroups: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: richard.nospam@gmail.com (Richard Harnden)
Newsgroups: comp.programming
Subject: FFs [was Re: A little puzzle]
Date: Tue, 22 Nov 2022 16:29:20 +0000
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <tlitd0$4c5i$1@dont-email.me>
References: <875yf8nijb.fsf@bsb.me.uk> <tliab3$3pa84$6@dont-email.me>
<87leo3kv55.fsf@bsb.me.uk>
Reply-To: nospam.harnden@gmail.com
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 22 Nov 2022 16:29:20 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="15c670326241f0b306a0484b95c7ad38";
logging-data="143538"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18KWsDJSpMYiiUYvBGDLRvL0khF1yE4Sjk="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.5.0
Cancel-Lock: sha1:ySCawa4Yqhu6LscdH5NUgzJb4hY=
In-Reply-To: <87leo3kv55.fsf@bsb.me.uk>
 by: Richard Harnden - Tue, 22 Nov 2022 16:29 UTC

On 22/11/2022 12:53, Ben Bacarisse wrote:
> Richard Heathfield <rjh@cpax.org.uk> writes:
>
>> On 21/11/2022 8:45 pm, Ben Bacarisse wrote:
>>> Do all the news
>>> readers used by programmers (or ex programmers) all respect the presence
>>> of a form-feed character...
>>
>> Dunno. Let's find out:
>>
>> Ctrl-L coming up:
>>
>>
>>
>
> Didn't see a form feed there. Here's one (I hope):
>

For me, the FFs work on windows but not on the mac. Both using thunderbird.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor