On Fri, Sep 20, 2024 at 8:22 PM Douglas McIlroy
<douglas.mcilroy(a)dartmouth.edu> wrote:
Moved to Coff, because it's about programming
style, not history.
Heh, I had deliberately removed the list in my response to you, but
it's not too embarrassing to have this redirected back to COFF. :-)
Perhaps
I'm missing something? Clever arithmetic in the index
calculation aside, this is semantically different than using an actual
negative integer to index into an array? Moreover, if the intent is to
start the sequence with 0, why set `fib(0)` to 1? How is this
substantially different from the usual way of writing this:
I said the Fibonacci example was silly. Maybe you'll be more convinced by the
binomial-coefficient program below.
[snip]
The caveat sent later notwithstanding, I agree that I was overly
fixated on the Fibonacci example in my response and this better
illustrates the motivation for the technique.
Regardless, I feel like we're somewhat speaking at cross-purposes. In
particular, this uses macros to introduce a more pleasant syntax, but
at the language level, the index into the underlying array is always
non-negative and within the array's defined bounds. This is
qualitatively and quantitatively different from using an actual
negative value in the actual indexing operation.
- Dan C.