Search                        Top                                  Index
HELP PRINTARROW                              Steven Hardy, February 1982

    <item_to_be_printed> =>
    <item_to_be_printed> ==>

Putting the print arrow, =>, after an expression is the simplest way of
printing something in POP-11. For example:

    3 + 5 =>
    ** 8

    [% 3 + 5, rev([a b c d]), 'a string'%] =>
    ** [8 [d c b a] a string]

If used in execute mode the print arrow prints everything on the stack,
for example:

    3 * 5; (4 - 2) * (4 + 2) =>
    ** 15 12

However, if used inside a procedure the print arrow prints only one
thing:

    define silly();
        3 * 5;
        (4-2) * (4 + 2) =>
    enddefine;

    silly();
    ** 12

In this example, the result of 3 * 5 hasn't been used and so remains on
the stack. The arrow inside the procedure prints out only the top thing
on the stack, and will produce a mishap if there is nothing on the
stack.

The 'pretty-printer' ==> can be used to tidy the printout of long lists
or vectors, for example:

    vars list;
    [[a b c d e f g h i j k l]
     {a b c d e f g h i j k l}
     [a b c d e f g h i j k l]
     {a b c d e f g h i j k l}] -> list;

    list =>
    ** [[a b c d e f g h i j k l] {a b c d e f g h i j k l} [a b c d e f g
         h i j k l] {a b c d e f g h i j k l}]

    list ==>
    ** [[a b c d e f g h i j k l]
        {a b c d e f g h i j k l}
        [a b c d e f g h i j k l]
        {a b c d e f g h i j k l}]

Unlike the standard print arrow (=>), at top level (not in a procedure
call), the pretty print arrow does not print out the entire contents of
the stack.

The two asterisks and a space printed out initially by => and ==> can be
altered by assigning a different string to the variable POP_=>_FLAG
whose default value is '** '. E.g. you can assign an empty string

    '' -> pop_=>_flag;

    list ==>
    [[a b c d e f g h i j k l]
        {a b c d e f g h i j k l}
        [a b c d e f g h i j k l]
        {a b c d e f g h i j k l}]

See also
TEACH *STACK   - explains the use of the stack in Pop-11
HELP *PRINT    - other printing procedures
REF  *PRINT    - details of printing procedures
REF  *SYSIO    - details of system/device I/O procedures
HELP *IO       - overview of documentation on system I/O
HELP *PRINTING - printing files

--- C.all/help/printarrow ----------------------------------------------
--- Copyright University of Sussex 1990. All rights reserved. ----------