Topic: APLX Help : Help on APL language : APL Primitives : ⍞ Bare output
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

Bare output


In addition to its use for inviting and displaying keyboard input, can be used to display values generated internally by APL statements, that's to say, a value or result can be assigned to ⍞. Bare output does not include a terminating newline (Carriage Return) character if it is followed by another bare output or character input. In addition, bare output does not include newlines if lines exceed printing width. Numeric values placed in in this way (rather than from the keyboard) are treated as numeric.

             A←⍞←1000
       1000                          (Note that the value is displayed
             A×3                      as well as being assigned to A)
       3000

An extract from a user-defined function

       [1]     ⍞ ← 'PLEASE TYPE YOUR NAME. '
       [2]     NAME←⍞
       [3]     'THANK YOU ',NAME

The dialogue will look like this (the user types the name REGINALD)

       PLEASE TYPE YOUR NAME. REGINALD
       THANK YOU                       REGINALD.

Note that there's no carriage return after the on line 1 - the name is typed in on the same line as the text.

Note too the spaces when the name is output. The exact form of the result of (here the variable NAME) will vary from implementation to implementation. In general, in a situation such as the one shown, APL notes the character position at which the response to starts (REGINALD starts at position 24) and stores the response preceded by a corresponding number of blanks. So the characters REGINALD preceded by 23 blanks are put in NAME and are subsequently displayed. (The system function ⎕DBR gets rid of blanks for you if you don't want them.) Check with your implementation notes issued in case the rules are different for your system.

The system variable ⎕PR (which is set to be a blank character by default) controls the characters used to replace the prompt. In the example above, if ⎕PR was set to some other character, then that character would be used in place of the 23 blanks. If ⎕PR was set to be an empty vector, then the actual prompt is returned. For more details see the entry for ⎕PR.


Topic: APLX Help : Help on APL language : APL Primitives : ⍞ Bare output
[ Previous | Next | Contents | Index | APL Home ]