Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39038
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Inclusive or exclusive array |
| Date | Wed, 31 Jul 2019 02:19:29 +0200 |
| Organization | A noiseless patient Spider |
| Lines | 41 |
| Message-ID | <qhqmsb$p10$1@dont-email.me> (permalink) |
| References | <87zhkvmqx8.fsf@munus.decebal.nl> <qhpsjq$ahi$1@dont-email.me> <87v9vjmkkn.fsf@munus.decebal.nl> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Wed, 31 Jul 2019 00:20:27 -0000 (UTC) |
| Injection-Info | reader02.eternal-september.org; posting-host="9a0bdf58e585a3e1aff07192634e1d1a"; logging-data="25632"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/o8AfDHt5kaMtsOlhBE1yp" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
| Cancel-Lock | sha1:ydlLsdCjtJsX/wkNeWtAAhmq9iw= |
| In-Reply-To | <87v9vjmkkn.fsf@munus.decebal.nl> |
| X-Antivirus-Status | Clean |
| Content-Language | en-US |
| X-Antivirus | AVG (VPS 190730-4, 07/30/2019), Outbound message |
| Xref | csiph.com comp.lang.java.programmer:39038 |
Show key headers only | View raw
On 2019-07-30 20:41, Cecil Westerhof wrote:
> Eric Sosman <esosman@comcast-dot-net.invalid> writes:
>
>> On 7/30/2019 12:24 PM, Cecil Westerhof wrote:
>>> I am writing the following method:
>>> Long[] getFibonacciArray(int from, int to);
>>>
>>> What is more logical: an inclusive or an exclusive array?
>>>
>>> Should:
>>> getFibonacciArray(12, 12)
>>>
>>> return 'Long[1] { 144 }', or 'Long[0] { }'?
>>
>> There are precedents for both, the latter being noticeably
>> more common. There is also precedent for
>>
>> Long[12] {144, 233, 377, 610, 987, 1597,
>> 2584, 4181, 6765, 10946, 17711, 28657}
>>
>> ... with a likely change of parameter name.
>>
>> Citations:
>>
>> java.lang.String::substring(int, int)
>> java.util.stream.IntStream::rangeClosed(int, int)
>> java.lang.String::new(char[], int, int)
>
> I was later also thinking about the third, but for the moment I go for
> exclusive.
To be clear, what Eric was trying to say, was that likely the most
common idiom of the sort, in Java, is:
[zero-based-index-inclusive, *length*]
... which largely alleviates the very issue you're referring to.
--
DF.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Inclusive or exclusive array Cecil Westerhof <Cecil@decebal.nl> - 2019-07-30 18:24 +0200
Re: Inclusive or exclusive array Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-07-30 12:52 -0400
Re: Inclusive or exclusive array Cecil Westerhof <Cecil@decebal.nl> - 2019-07-30 20:41 +0200
Re: Inclusive or exclusive array Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-07-31 02:19 +0200
Re: Inclusive or exclusive array Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-07-31 07:22 -0400
Re: Inclusive or exclusive array Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-08-01 00:44 +0200
Re: Inclusive or exclusive array Andreas Leitgeb <avl@logic.at> - 2019-08-01 08:02 +0000
Re: Inclusive or exclusive array Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-08-01 07:47 -0400
Re: Inclusive or exclusive array Arne Vajhøj <arne@vajhoej.dk> - 2019-08-01 11:19 -0400
Re: Inclusive or exclusive array Eric Douglas <e.d.programmer@gmail.com> - 2019-08-01 10:04 -0700
Re: Inclusive or exclusive array nobody@example.org (Scott) - 2019-08-02 17:51 +0000
Re: Inclusive or exclusive array Eric Douglas <e.d.programmer@gmail.com> - 2019-08-02 10:58 -0700
Re: Inclusive or exclusive array nobody@example.org (Scott) - 2019-08-03 05:40 +0000
Re: Inclusive or exclusive array Arne Vajhøj <arne@vajhoej.dk> - 2019-08-03 21:32 -0400
Re: Inclusive or exclusive array Eric Douglas <e.d.programmer@gmail.com> - 2019-08-05 05:04 -0700
Re: Inclusive or exclusive array Arne Vajhøj <arne@vajhoej.dk> - 2019-08-05 19:30 -0400
Re: Inclusive or exclusive array Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-08-01 14:20 -0400
Re: Inclusive or exclusive array Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-08-02 01:15 +0200
Re: Inclusive or exclusive array Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-08-02 16:17 -0400
IntStream.rangeClosed() (was: Re: Inclusive or exclusive array) Andreas Leitgeb <avl@logic.at> - 2019-07-31 11:33 +0000
Re: IntStream.rangeClosed() Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-07-31 07:59 -0400
Re: IntStream.rangeClosed() Eric Douglas <e.d.programmer@gmail.com> - 2019-07-31 05:40 -0700
Re: IntStream.rangeClosed() Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-07-31 11:02 -0400
Re: IntStream.rangeClosed() Eric Douglas <e.d.programmer@gmail.com> - 2019-07-31 08:39 -0700
Re: IntStream.rangeClosed() Martin Gregorie <martin@mydomain.invalid> - 2019-07-31 16:46 +0000
Re: IntStream.rangeClosed() Eric Douglas <e.d.programmer@gmail.com> - 2019-07-31 10:16 -0700
Re: Inclusive or exclusive array Marcel Mueller <news.5.maazl@spamgourmet.org> - 2019-07-30 23:21 +0200
Re: Inclusive or exclusive array Arne Vajhøj <arne@vajhoej.dk> - 2019-07-30 19:43 -0400
csiph-web