Next: , Up: READ OUT and WRITE IN   [Index]


7.7.1 INTERCAL-72 I/O

INTERCAL-72 C-INTERCAL CLC-INTERCAL J-INTERCAL
yes all versions see text all versions

INTERCAL-72 had its own versions of I/O commands; these commands are available in all modern INTERCAL compilers as well (but CLC-INTERCAL implements output slightly differently). To distinguish INTERCAL-72 input and output from the other more modern types of I/O, the READ OUT and WRITE IN commands must take one of the following values: a onespot or twospot variable, a single element of a tail or hybrid array, or (in the case of READ OUT) a constant, meaning that these are some examples of the possible forms:

READ OUT .1
READ OUT ;2 SUB .3:4
READ OUT #3
WRITE IN :4
WRITE IN ,5 SUB #6

The statements do what you would expect; READ OUT outputs its argument to the user, and WRITE IN inputs a number from the user and assigns it to the variable or array element referenced. (If the variable, or the array that contains the array element, happens to be read-only, the input or output still happens but in the case of WRITE IN silently skips the assignment, instead throwing away the input.) The formats used for input and output are, however, different from each other and from the formats used by most mainstream languages.

Input is achieved by writing a number in decimal, one digit at a time, with each digit written out as a word; so to input the number 12345, a user would have to type ONE TWO THREE FOUR FIVE as input (if they were using English, the most portable choice of language). In INTERCAL-72 only English is accepted as a language, but other compilers accept other languages in addition. C-INTERCAL from version 0.10 onwards accepts English, Sanskrit, Basque, Tagalog, Classical Nahuatl, Georgian, and Kwakiutl; also Volapük from version 0.11 onwards, and Latin from version 0.20 onwards. J-INTERCAL accepts the same languages, except with Esperanto instead of Latin; from version 0.05 of CLC-INTERCAL onwards, the same list of languages as C-INTERCAL is supported (apart from Latin, which was added in version 1.-94.-8), plus Scottish Gaelic.

The format that output can be read in is a modified form of Roman numerals, known as ‘butchered’ Roman numerals. INTERCAL-72, C-INTERCAL and J-INTERCAL do this the same way; CLC-INTERCAL is somewhat different. The characters ‘I’, ‘V’, ‘X’, ‘L’, ‘C’, ‘D’, and ‘M’ mean 1, 5, 10, 50, 100, 500 and 1000 respectively, placing a lower-valued letter after a higher-valued letter adds them, and placing a lower-valued letter before a higher-valued letter subtracts it from the value; so ‘XI’ is 11 and ‘IX’ is 9, for instance. In INTERCAL-72, C-INTERCAL, and J-INTERCAL, a bar over a numeral multiplies its value by 1000, and writing a letter in lowercase multiplies its value by 1000000; however, CLC-INTERCAL uses lowercase to represent multiplication by 1000 and for multiplication by 1000000 writes a backslash before the relevant numeral.


Next: , Up: READ OUT and WRITE IN   [Index]