Home Manual Packages Global Index Keywords Quick Reference | # functions in std.i - w
warranty |
     warranty

    keyword,  defined at i0/std.i   line 72
SEE | copyright
where |
                 where(x)

         returns the vector of longs which is the index list of non-zero
         values in the array x.  Thus, where([[0,1,3],[2,0,4]]) would
         return [2,3,4,6].  If noneof(x), where(x) is a special range
         function which will return a nil value if used to index an array;
         hence, if noneof(x), then x(where(x)) is nil.
         If x is a non-zero scalar, then where(x) returns a scalar value.
         The rather recondite behavior for scalars and noneof(x) provides
         maximum performance when the merge function to be used with the
         where function.

    builtin function, documented at i0/std.i   line 758
SEE ALSO: | where2, merge, merge2, allof, anyof, noneof, nallof, sort
where2 |
                 where2(x)

         like where(x), but the returned list is decomposed into indices
         according to the dimensions of x.  The returned list is always
         2 dimensional, with the second dimension the same as the dimension
         of where(x).  The first dimension has length corresponding to the
         number of dimensions of x.  Thus, where2([[0,1,3],[2,0,4]]) would
         return [[2,1],[3,1],[1,2],[3,2]].
         If noneof(x), where2 returns [] (i.e.- nil).

    interpreted function, defined at i0/std.i   line 772
SEE ALSO: | where, merge, merge2, allof, anyof, noneof, nallof, sort
write |
                 n= write(f, format=fstring, linesize=l, obj1, obj2, ...)
                 n= write(format=fstring, linesize=l, obj1, obj2, ...)
     	 or strings= swrite(format=fstring, linesize=l, obj1, obj2, ...)

         writes text to I/O stream F (1st form), or to the terminal (2nd
         form), or to the STRINGS string array (3rd form), representing
         arrays OBJ1, OBJ2, ..., according to the optional FSTRING.  The
         optional linesize L defaults to 80 characters, and helps restrict
         line lengths when FSTRING is not given, or does not contain
         newline directives.  The write function always appends to the
         end of a text file; the position for a sequence of reads is
         not affected by intervening writes.
         There must be one conversion specifier (see below) in FSTRING for
         each OBJ to be written; the type of the conversion specifier must
         generally match the type of the OBJ.  That is, an integer OBJ
         requires an integer specifier (d, i, o, u, x, or c) in FSTRING,
         a real OBJ requires a real specifier (e, f, or g), a string OBJ
         requires the string specifier (s), and a pointer OBJ requires a
         the pointer specifier (p).  An OBJ may not be complex, a structure
         instance, or any non-array Yorick object.  If FSTRING is not
         supplied, or if it has fewer conversion specifiers than the
         number of OBJ arguments, then Yorick supplies default specifiers
         (" %8ld" for integers, " %14.6lg" for reals, " %s" for strings, and
         " %8p" for pointers).  If FSTRING contains more specifiers than
         there are OBJ arguments, the part of FSTRING beginning with the
         first specifier with no OBJ is ignored.
         The OBJ may be scalar or arrays, but the dimensions of the OBJ
         must be conformable.  If the OBJ are arrays, Yorick behaves as
         if he write were called in a loop dimsof(OBJ1, OBJ2, ...) times,
         writing one array element of each of the OBJ according to FSTRING
         on each pass through the loop.  The swrite function returns a
         string array with dimensions dimsof(OBJ1, OBJ2, ...).  The write
         function inserts a newline between passes through the array if
         the line produced by the previous pass did not end with a
         newline, and if the total number of characters output since the
         previous inserted newline, plus the number of characters about
         to be written on the current pass, would exceed L characters
         (L defaults to 80).  The write function returns the total
         number of characters output.
         The FSTRING is composed of a series of "directives" which are
         (1) characters other than % -- copied directly to output
         (2) conversion specifiers beginning with % and ending with a
             character specifying the type of conversion -- specify
    	 how to convert an OBJ into characters for output
         The conversion specifier is of the form %FW.PSC, where:
         F is zero or more optional flags:
           - left justify in field width
           + signed conversion will begin with either + or -
             (space) signed conversion  will begin with either space or -
           # alternate form (see description of each type below)
           0 pad field width with leading 0s instead of leading spaces
         W is either a decimal integer specifying the minimum field width
           (padded as specified by flags), or not present to use the
           minimum number of characters required.
         .P is either a decimal integer specifying the precision of the
           result, or not present to get the default.  For integers, this
           is the number of digits to be printed (possibly forcing leading
           zeroes), and defaults to 1.  For reals, this is the number of
           digits after the decimal point, and defaults to 6.  For strings,
           this is the maximum number of characters to print, and defaults
           to infinity.
         S is either one of the characters 'h', 'l', or 'L', or not
           present.  Yorick allows this for compatibility with the C
           library functions, but ignores it.
         C is a character specifying the type of conversion:
           d, i  - decimal integer
           o     - octal integer (# forces leading 0)
           u     - unsigned decimal integer (same as d for Yorick)
           x, X            - hex integer (# forces leading 0x)
           f     - floating point real in fixed point notation
                   (# forces decimal)
           e, E  - floating point real in scientific notation
           g, G  - floating point real in fixed or scientific notation
                   depending on the value converted (# forces decimal)
           s   - string of ASCII characters
           c   - integer printed as corresponding ASCII character
           p   - pointer
           %   - the ordinary % character; complete conversion
                 specification must be "%%"
         The write function is modeled on the ANSI standard C library
         fprintf and sprintf functions, but differs in several respects:
           (1) Yorick's write cannot handle the %n conversion specifier
               in FSTRING.
           (2) Yorick's write may insert additional newlines if the OBJ
               are arrays, to avoid extremely long output lines.

    builtin function, documented at i0/std.i   line 1373
SEE ALSO: | print, exit, error, read, rdline, open, close, save, restore