Hi, As Carl Read mentioned, number and series are pseudo datatypes to group some similar datatypes. You can do "A: MAKE INTEGER! 5" but cannot do "A: MAKE NUMBER! 5" for example. It is mostly useful when you PARSE an input.
PARSE [A 4.3 [x]] [word! number! series!] ;== true PARSE [B 5 "hello"] [word! number! series!] ;==true So you can iterate or something if it is a series! type. Fri, 05 Nov 2010 14:40:38 +0200 tarihinde Duke Normandin <[email protected]> şöyle yazmış: > > On Fri, 5 Nov 2010, Carl Read wrote: > >> >> On Thursday, 4-Novenber-2010 at 22:45:03 Duke Normandin wrote, >> >> >> As another quick example, there's a datatype called number! that both >> >> integer! and decimal! fall under. >> > >> >I've been thinking the very same thing! But is "number" the data-type, >> >or integer and decimal the data-type (as in other languages). You see? >> > >> number! and series! are called pseudo-types to distinguish them from >> the other, normal datatype. > > OK! We're getting close... > > What is the motivation/reason for having a pseudo-type? > >> >I don't see the point, e.g. using the Pascal family paradigm, of having >> >LONGINT, INTEGER, SHORTINT, REAL etc, which are data-types, and giving >> >them the collective name of "numbers". What would be the point? >> >> Well, if you're doing maths you can then check if the data is a >> number... >> >> >> integer? 7 >> == true >> >> integer? 7.5 >> == false >> >> number? 7 >> == true >> >> number? 7.5 >> == true > > Sure ... REBOL has "predicates" that asks a question about a data-type > - "are you an integer?" yes or no? Are you a "real"? yes or no? > > But what's the point of asking, "are you a number? The question is too > broad, is it not? Does asking "are you a number?" lead me down a > different path than asking the question, "are you an integer?" ? > > Get my point? > -- To unsubscribe from the list, just send an email to lists at rebol.com with unsubscribe as the subject.
