1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WAD ISO8601 Plugin

Discussion in 'Plugins' started by Steve Fabian, Feb 28, 2012.

  1. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Charles:
    1/ @ord should return the "invalid number" error message when the parameter is less than 1 - the first ordinal number is "first". There is no "0th", "-1st", etc.

    2/ Your time format conversions do not work when the time is specified as "pm12:mm:ss" or "p12:mm:ss". Move the pm (or p) to the end, it works. Only the hour from PM12:00 has problem. 12:00PM works...
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,299
    Likes Received:
    39
    Technically you are correct, but zeroth is certainly not unknown. Why spoil the fun?

    It works here, at least in @TIMEFMT. Can you give me an example?
     
  3. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    You mean the planet that's closer to the Sun than the closest planet? Or the dollar you earned before you earned your first dollar? Or the version of 4DOS before its first version?

    Sorry, cockpit error. It was my old function that I tested together with @timefmt in the same ECHO command which failed.
     
  4. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,299
    Likes Received:
    39
    The first in a zero-based series, lest you be forced to call value #1 the "second", value #2 the "third", and so on. Looking at software version numbers, you might have a major version of 0 for betas, followed by version 1 for the first release, version 2 for the second release.... so the betas might be called the 0th release.

    None of which justifies negative ordinals, I know. But I figure anybody who passes negative numbers must have some rationale.
     
  5. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    You mean schemes designed for programmers, not persons. Let the programmer figure out the difference between offset and index, don't put the burden on the compiler. A great source of confusion, as resulted in many people thinking that the first century was 99 years long, but subsequent ones 100, so that the 2nd century began with the 100th year, not the 101st.
    Your children's first year began at birth, their 2nd year on the day they turned 1 year old, etc. Allowing "zeroth" is making a mockery of languages which distinguish between ordinal numbers and cardinal numbers.

    But not a logical one!
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,299
    Likes Received:
    39
    Hey, you can talk about me that way -- but I think you owe Rex an apology!

    Your logical points are all quite correct, but I really don't think the issue is worth a new build, especially as a new build at this point would involve upgrading the whole project to Visual Studio 2010. In the unlikely event that anybody out there is using my plugin to perpetrate negative ordinals, well, I'll just let them slide for a while longer. I'll deal with the matter when I have a real bug to fix, or a real feature to add.
     
  7. mfarah

    Joined:
    Nov 2, 2009
    Messages:
    226
    Likes Received:
    5
    Hey, do you support "nth" as output for "n"? ;)
     
  8. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Sorry, in an earlier version which got lost without posting (and you only see a small part of what you are entering) I explicitly referred to the inventors of the C language (and its successors, C++ and C#) as the perpetrators of using numbers other than natural numbers as array indexes. [OT: Fortran for decades allowed explicit specification of the lower and upper limits of an array dimension to be any integer, positive OR negative, whatever best suites the project.] Undoubtedly it was the language in which 4DOS was written, hence the method. What is confusing in TCC (and its ancestors) is that some functions reporting counts return the last entity's offset, using -1 for "none", e.g. @LINES[], but most provide the actual count, e.g., @WORDS[].

    [/quote]Your logical points are all quite correct, but I really don't think the issue is worth a new build.[/quote]
    I agree.
     
  9. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Limited visibility of my reply caused my OT remark about Fortran to be misplaced, and the use of the "end of quotation" marker instead of the "start of quotation" marker, but I am sure you have the DWIM parser between your ears (wouldn't Rex like to get it into the code!).
     
  10. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    648
    Likes Received:
    1
    In Mathematics, the ordinal numbers start with zero (the empty set). You'll often see a "Section 0" in a math paper, frequently the introduction. Besides Fortran, Pascal also allows an arbitrary index for the lower limit of an array. In Delphi, I create my own version of the TList class that lets me set the lower limit (and give it a name).
     
  11. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    David, I was taught that 0 is the cardinal number of the set, not the ordinal number. The Latin word "ordinalis" (anglicized as "ordinal") is derived from the verb "ordinare", to put in order. You cannot put in order an empty set, how can existing items have a position before the first one? Who is in the 0th place in a competition?
     
  12. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    648
    Likes Received:
    1
    The empty set is both an ordinal and a cardinal. The ordinals are certain sets that are well-ordered (in von Neumann's version of the ordinals). Every well-ordered set is order-isomorphic to an ordinal. The empty set is well ordered (by epsilon, i.e., by the "element of" relation). Definition: A set is well-ordered if every non-empty subset has a smallest element.

    The natural numbers (0, 1, 2, ...) are both ordinals and cardinals. There are lots of infinite ordinals that are not cardinals.

    There are probably various treatments of this on the Web. When I took set theory in graduate school, we used "Set Theory" by Kenneth Kunen as the textbook. Kunen is a well-known text. He covers ordinals and cardinals in the first chapter. For a less formal treatment, "Naive Set Theory" by Paul Halmos is nice. Here are some of the ordinals that Halmos lists (I'll write "w" for omega): 0, 1, 2, ..., w, w+1, w+2, ..., w2, w2+1, w2+2, ..., w3, ..., w4, ..., w^2, w^2+1, ..., w^2+w, w^2+w+1, ..., w^2+w2, ... w^3, ..., w^w, ..., w^(w^w), ..., w^(w^(w^w)), ... He lists some more, but that should give you an idea.

    The Romans didn't have zero. It took a long time for people to realize that having zero as a number was useful.
     
  13. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Of course, I started talking about natural language, and the few languages I am familiar with define the term "natural number" to mean positive integers - which does not include zero. They do not use the adjectives "ordinal" and"cardinal" as nouns, either. And in all of these few languages the words used for the smallest ordinal numbers are vastly different from the words for the corresponding cardinal numbers. The technical terms used by set theoreticians do not necessarily correspond to their use in natural languages outside of their specific field, not even in other fields of science.
     
  14. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    648
    Likes Received:
    1
    As I said, the terms are standard in Mathematics, and have been for around a century (I'm not sure of the exact history). Everyone who takes enough math in college will know them. Other fields are often excruciatingly slow in picking up advances in mathematics: I still see people use "finite" to mean neither infinite nor infinitesimal ("finite probability"). It is distressing that so many people (especially physicists) still seem to think that a function is a formula or expression (something that mathematicians got away from a century and a half ago). Few people probably know the modern definition of "random variable".

    In Mathematics, the term "natural numbers" sometimes means positive integers and sometimes nonnegative integers, so if you use it, you should define it.

    I'm not sure how you would use "cardinal" as an adjective, unless you mean the phrase "cardinal number".

    Regarding "You cannot put in order an empty set", since there are no elements, the elements are well-ordered by the empty order relation.

    By the way, all the infinite ordinals I named above have the same cardinality.
     
  15. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Maybe you are referring to "new mathematics"; my books universally define "natural numbers" as positive integers, esp. dictionaries of English. To me that is natural - zero in sciences inidicates absence, not presence; negative quantities are always based on a reference quantity; often "zero" means a quantity that matches the reference, as in DC voltages.
    Have you heard of cardinal directions?

    To get back to my OP, TCC is not a language intended for mathematics, esp. for set theory (although it can be so used), thus IMHO the function's domain should be the dictionary-defined set of natural numbers.
     
  16. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    648
    Likes Received:
    1
    I've no idea what you mean by "new mathematics". About half the math books I've used include zero in the natural numbers. Of course, each author chooses the definition that is convenient. If you construct the natural numbers, then it is natural to start with zero. Even elementary school students need to use zero to write numbers like ten, so why not include zero in the "natural numbers"? Of course, from a computer science or programming perspective, it is very natural to include zero (often too convenient, so it is used when one would be better).

    If all the books you've looked at leave out zero, then you've been lucky. E.g., http://mathworld.wolfram.com/WholeNumber.html notes that zero is sometimes included and sometimes not.

    "cardinal" as an adjective means 1. of main importance; principal; chief, 2. bright-red, like the robe of a cardinal. Not quite the same as what we mean when we use "cardinal" to denote quantity.

    "dictionary-defined set of natural numbers": For definitions of mathematical terms, I think English dictionaries don't always do a good job of giving the mathematical definitions.
     

Share This Page