Alright, that is counter-intuitive too, so I might as well explain.
A
Number object represents a, well, number. This number is the result of a virtual die roll.
A
List object represents a list of numbers (therefore
Number objects indeed), or rather a series of die roll results. So yes, List HAS-A Number is true as well. But in certain circumstances, this List has to behave as if it were a Number.
For example, if I roll three dice, and then want to add 2 (the number 2) to the total result, I would need the sum of the two dice. This is when the List object should behave like a Number.
Now, a completely valid question would be: why would you want to store the result of each individual die? Why not adding them together right away?
There is an explanation for that too, you know. Imagine the same dice roll (three dice), but I only want to use the two best ones and discard the third. In this case, the List truly is a list, and not a mere number. It makes sense to store the individual results and not the total sum of the roll.
Conclusion
To answer your question: yes, list HAS-A number, but also list IS-A number (subclass).
Or do I get it wrong?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.