Default Format | ": _ 1 _ | Format |
Default output is identical to this monadic case, providing a
minimum of one space between columns. For example:]text=: ": i. 2 5 0 1 2 3 4 5 6 7 8 9 $ text 2 9 3 + text |domain error | 3 +text '*#' ,. text *0 1 2 3 4 #5 6 7 8 9 ": 'abcd' abcd $ ": '' 0 |
x":y produces a literal representation of y
in a format specified by x . Each element of x is a
complex number w j. d , controlling the representation
of the corresponding column of y as follows: |w specifies the width allocated; if this space is inadequate, the entire space is filled with asterisks. If w is zero, enough space is allocated. |d specifies the number of digits following the decimal point (itself included only if d is not zero). Any negative sign is placed just before the leading digit. If w>:0 and d>:0, the result is right-justified in the space. Otherwise (if w<0 or d<0), the result is put in exponential form (with one digit before the decimal point) and is left-justified except for two fixed spaces on the left (including one for a possible negative sign). The format w+d%10 (or its negation) is obsolescent; e.g. _7.2 instead of _7j2. See below for boxed arguments. |
n ; 6j2 ": n=: % i. 2 4 +--------------------------+------------------------+ | _ 1 0.5 0.333333| _ 1.00 0.50 0.33| |0.25 0.2 0.166667 0.142857| 0.25 0.20 0.17 0.14| +--------------------------+------------------------+ (7j2 ": -n) ; (3j2 ": n) +----------------------------+------------+ | __ _1.00 _0.50 _0.33| _*********| | _0.25 _0.20 _0.17 _0.14|************| +----------------------------+------------+ 6j3 0j_6 ": 1r2 ^ 1 1000 *"1 i.5 2 1.000 9.332636e_302 0.250 8.128549e_904 0.063 7.079811e_1506 0.016 6.166381e_2108 0.004 5.370801e_2710The fit conjunction (!.) and 9!:10 specify the number of digits for floating-point numbers. For example:
(": ; ":!.6 ; ":!.4 ; ":!.15) %7 +--------+--------+------+-----------------+ |0.142857|0.142857|0.1429|0.142857142857143| +--------+--------+------+-----------------+For a boxed right argument, a two-element left argument specifies position in the display, using 0, 1, and 2 for top/center/bottom, and left/center/right. 9!:16 and 9!:17 specify the default positions. 9!:6 and 9!:7 specify the box drawing characters used.
x=: 2 3 $ (2 #&.> 1+i.6) $&.> 'abcdef' (": x) ,. (2 1 ": x) +----+-----+------++----+-----+------+ |a |bb |ccc || | | ccc | | |bb |ccc || | bb | ccc | | | |ccc || a | bb | ccc | +----+-----+------++----+-----+------+ |dddd|eeeee|ffffff|| | |ffffff| |dddd|eeeee|ffffff|| |eeeee|ffffff| |dddd|eeeee|ffffff||dddd|eeeee|ffffff| |dddd|eeeee|ffffff||dddd|eeeee|ffffff| | |eeeee|ffffff||dddd|eeeee|ffffff| | | |ffffff||dddd|eeeee|ffffff| +----+-----+------++----+-----+------+