____ ____ ____ ____ ||n |||i |||m |||f || ||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|
Numbers are the building blocks of all programing languages, and nimf is no exception. Everything in nimf is a number, with the exception of word names (which eventually down the programming line do get converted to numbers, but the nimf source code treats them as strings in golang).
Any time a number is encountered in nimf it gets added to the stack, as you can see in the following example:
12 35 .s
126 .s
Which produces the following output:
<2>[12 35] <3>[12 35 126]
In nimf, the following are all numbers:
104 is clearly a number, and will get added to the top of the stack. Numbers that begin with 0x are hexidecimal number. Numbers that begin with 0o are octal numbers. Numbers that begin with 0b are binary numbers. All three of the listed hexidecimal, octal, and binary numbers are also 104 when converted to decimal. nimf can support a fairly decent array of integers.
As you will see in the next section of this guide, character literals are also numbers. `h will put the number 104 on the stack. So, in effect, the first two examples are identical to the system and a bit of syntactic sugar allows you to view one as a character in your source code.
The final example, the string 'hello, world' at first doesn't seem like a number. Which is true, it is not a single number... it is 13 separate numbers. They don't go on the stack like normal numbers though, they get stored to a special buffer in memory for strings. However, they are still stored as the numerical values of their characters, just like `h was. You can read more about the intricacies of strings in the strings section of this guide.
Words are not numbers. For purposes of this discussion, a word in nimf is anything that is not a number, as defined above (strings are an in-between case where they, in their literal form, are not numbers to the parser... but when they are evaluated they become a group of numbers). Not all words are known to the interpreter, but anything that is not a number gets treated as a word, and if the word is not known then an error will be thrown.
Because nimf only knows numbers as integers (whole numbers) a floating point number like 123.2789 is considred a word. Entering a floating point number will likely produce an error in most cases (unless some strange word naming is going on). However, a negative number like -123 is perfectly understood by the interreter to be a number.
Since numbers are the building blocks of all nimf programs they are used for just about everything.
The nimf interpreter's builtins mostly focus on dealing with numbers via arithmetic opperations, or manipulating numbers on the stack.