## ŒBOX Vector to/from Matrix

Converts a vector to a matrix, or a matrix to a vector using optional fill characters and line delimiters. ŒBOX will only accept simple arguments.

### One-argument form

In creating a matrix from a vector, ŒBOX uses the space characters in the vector to determine the line breaks. It also uses the space character as a filler to make up the lines to the same length.

                 ŒBOX 'LEE PRENDERGAST PSMITH'
           LEE
           PRENDERGAST
           PSMITH

When ŒBOX is used to convert a matrix into a vector it will treat the space character(s) at the end of each row as fillers, and will separate the original rows by spaces in the resultant vector:

                 TAB
           APL
           LISP
           PASCAL
                 ŒBOX TAB
           APL LISP PASCAL

### Two-argument form

The two argument form of ŒBOX accepts one or two character left argument. The first character is used as the delimiter and the second the filler. If no filler is specified, the space character is used. In this example, ŒBOX has a left argument of '*' and it uses '*' to determine breaks between lines:

                 '*' ŒBOX 'JAN FEB MAR* 1  2   3'
           JAN FEB MAR
            1   2   3

Here's an example with '.' used as the filler:

                 '/.' ŒBOX 'LEE/PRENDERGAST/PSMITH'
           LEE........
           PRENDERGAST
           PSMITH.....

In this next example, $ is treated as the delimiting character and the space character as the filler in the matrix TAB (defined above):

                 '$' ŒBOX TAB
           APL$LISP$PASCAL

If the matrix contains 'filler' symbols, these can be removed:

                 NAMETAB
           LEE........
           PRENDERGAST
           PSMITH.....
                 '$.' ŒBOX NAMETAB
           LEE$PRENDERGAST$PSMITH

ŒBOX can also use numeric left and right arguments in the same way as character arguments. By default the delimiter and fill numbers are both 0.

                 ŒBOX 1 2 3 0 1 2
           1 2 3
           1 2 0
                 ¯1 ¯6 ŒBOX 2 3 4 ¯1 6 ¯1 ¯1 8 2
            2  3  4
            6 ¯6 ¯6
           ¯6 ¯6 ¯6
            8  2 ¯6

Topic: APLX Help : Help on APL language : System Functions & Variables : ŒBOX Vector „… Matrix

[ Previous | Next | Contents | Index ]