Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: I prefer my indexes to start at:

by BillKSmith (Monsignor)
on Sep 01, 2022 at 12:28 UTC ( [id://11146610]=note: print w/replies, xml ) Need Help??


in reply to I prefer my indexes to start at:

I voted for '0', but only as a default. I do want the option to change it. Mathematicians usually publish algorithms using '1'. Implementing them using '0' can be challenging.
Bill

Replies are listed 'Best First'.
Re^2: I prefer my indexes to start at:
by Ratazong (Monsignor) on Sep 01, 2022 at 13:17 UTC

    Since coding in c, I got used to start with zero ... and kept it. If there are algorithms (or data interfaces) that are more convenient starting with 1, I usually keep the data on index zero empty or use it for default values, as wasting one additional element is no issue nowadays ....

    So long, Rata

Re^2: I prefer my indexes to start at:
by hippo (Bishop) on Sep 01, 2022 at 13:11 UTC

    I can't say that I've ever read a published pure maths paper - if I did it was so long ago I have forgotten.

    OTOH, every time I have seen the Fibonacci Sequence defined it has been like this:

    • F0 = 0
    • F1 = 1
    • Fn = Fn-1 + Fn-2 (for n > 1)

    Perhaps it is the exception? I voted for zero anyway. Cardinal, not ordinal. But you are right that having the choice is good.


    🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11146610]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-03-29 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found