{"id":524,"date":"2011-01-14T10:14:58","date_gmt":"2011-01-14T15:14:58","guid":{"rendered":"http:\/\/alarmingdevelopment.org\/?p=524"},"modified":"2011-01-14T15:29:23","modified_gmt":"2011-01-14T20:29:23","slug":"why-we-shouldnt-number","status":"publish","type":"post","link":"https:\/\/alarmingdevelopment.org\/?p=524","title":{"rendered":"Why we shouldn&#8217;t number"},"content":{"rendered":"<p>The discussion on my previous post (<a href=\"http:\/\/alarmingdevelopment.org\/?p=470\">Why numbering should start at one<\/a>) suggests a new approach. Maybe these blogging tubes are good for something after all.<br \/>\n<!--more--><\/p>\n<p>We access the elements of a sequence (AKA array, string) using a new immutable datatype called <tt>Ordinal<\/tt>. We can ask a non-empty sequence what the ordinals of its first and last elements are. The first ordinal of all sequences are equal, so we can define the literal constant <tt>first<\/tt>.<\/p>\n<p>We can add an integer offset to an ordinal to get a new ordinal. We can subtract two ordinals to get the integer distance between them. But we can not add two ordinals together. Most importantly, we can not convert ordinals into integers or vice-versa.<\/p>\n<p>Thus the question of whether to number starting at 0 or 1 is abstracted away. I conjecture that many fencepost errors are also eliminated by making a type distinction between ordinals and lengths, and preventing their direct interconversion. Ordinals can be seen as a special kind of collection iterator with a distance metric and a designated instance <tt>first<\/tt>.<\/p>\n<p>Using integers as ordinals is rep exposure! Abstract data types rule.<\/p>\n<hr \/>\n<p>Based on the conversation below I am retracting this proposal. It doesn&#8217;t really solve the problem of indexing conventions, just pushes it up a layer. Not worth the complexity. I am left still believing that that choice of index base is purely conventional, and that the widespread belief that 0-based indexing is superior is just a myth we inherited from Assembly Language which now serves mostly as a tribal marker. I would be happy to see some example that shows a real difference.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The discussion on my previous post (Why numbering should start at one) suggests a new approach. Maybe these blogging tubes are good for something after all.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-524","post","type-post","status-publish","format-standard","hentry","category-general"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pfEnU-8s","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=\/wp\/v2\/posts\/524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=524"}],"version-history":[{"count":15,"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=\/wp\/v2\/posts\/524\/revisions"}],"predecessor-version":[{"id":536,"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=\/wp\/v2\/posts\/524\/revisions\/536"}],"wp:attachment":[{"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alarmingdevelopment.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}