Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: Alphabetic Summary of Functions Up: Predefined Functions and Variables Previous: Global Variables

Subsections


Function Summary by Category

Here is a summary of all of the Glish functions and variables according to their categories.

Type Identification

Functions for finding out about the type of a value:
    is_boolean(x)
    is_byte(x)
    is_short(x)
    is_integer(x)
    is_float(x)
    is_double(x)
    is_complex(x)
    is_dcomplex(x)
    is_string(x)
    is_regex(x)
    is_record(x)
    is_function(x)
    is_agent(x)
    is_numeric(x)
    is_fail(x)
    is_file(x)
each return T if x has the given type and F if it doesn't.
    is_const(x)
    is_modifiable(x)
is_const only returns T if x is const, i.e. cannot be reassigned and cannot be modified. is_modifiable returns T if x can be modified.
    type_name(x)
    full_type_name(x)
return a string value identifying x's type.
    field_names(x)
returns a string vector listing all of the fields in the record x.
    has_field(x,field)
returns T if x is a record with a field named field in it, F otherwise.

Type Conversion

    as_boolean(x)
    as_byte(x)
    as_short(x)
    as_integer(x)
    as_float(x)
    as_double(x)
    as_complex(x)
    as_dcomplex(x)
    as_string(x)
return the value x converted to the given type.

    floor(x)
    ceiling(x)
converts x to a integer value by truncating and promotion respectively.

Vector and Array Manipulation

    length(...)
    len(...)
return the lengths of its arguments.
    sum(...)
    prod(...)
returns the sum of all of the elements of all of the arguments.
    min(...)
    max(...)
return the minimum and maximum element among its arguments.
    range(...)
returns a 2-element vector giving the minimum of all of the arguments in the first element and the maximum of all of the arguments in the second.
    sort(x)
returns x sorted into ascending order.
    sort_pair(x,y)
returns y rearranged to match the ascending order of x.
    unique(x)
returns the unique elements x sorted in ascending order.
    order(x)
returns the indices of the sorted elements of x.
    real(x)
    imag(x)
return the real and imaginary portions respectively of x
    complex(x,y)
creates a complex vector from two numeric vectors. Operates element by element, or scalar paired with elements.
    conj(x)
returns the complex conjugate of x.
    arg(x)
returns the argument of a complex number, x.
    sqrt(x)
    exp(x)
    log(x)
    ln(x)
    sin(x)
    cos(x)
    tan(x)
    asin(x)
    acos(x)
    atan(x)
    abs(x)
each return values corresponding to applying the given mathematical function element-by-element to x.
    all(x)
returns T if every element of x is T or non-zero.
    any(x)
returns T if any element of x is T or non-zero. The functions
    seq(x)
    seq(x,y)
    seq(x,y,z)
return the integers from 1 to x, or the length of x if x is not a scalar; return the numbers (possibly double instead of integer) from x to y, incrementing each time by 1; or return the numbers from x to y incrementing by z.
    ind(x)
returns a vector of integer indices ranging from 1 to the length of x.
    rep(value,count)
returns a vector consisting of count copies of value if count is a scalar or count[i] copies or each value[i] if count is a vector whose length is equal to value's. Both arguments must be numeric.
    array(init, ...)
creates an array initialized to init and with dimensions of length specified in the subsequent parameters.
    shape(x)
return the shape of x.
    cbind(a, ...)
    rbind(a, ...)
returns an array which is created by augmenting a with the columns or rows (respectively) of the following arguments.

Value Creators

    time()
returns the system time in seconds since 00:00, January 1, 1970.
    random()
    random(n)
    random(start,stop)
returns a random integer(s).

String Functions

    paste(...,sep=' ')
    spaste(...)
treat their arguments as string's and return their concatenation, using sep as a separator (for paste()) or nothing (for spaste()).
    split(s)
    split(s,sep)
splits the string s at each run of whitespace (or any character in sep), returning a multi-element string value.
    sprintf(format, ... )
format one or more values using format and return the resultant string.
    strlen(str)
return the number of characters in each element of the string str.
    tr(r1, r2, str)
translate the characters in str mapping characters from range r1 to range r2.
    to_lower(str)
    to_upper(str)
convert the characters in str to lower or upper case characters.

Manipulating Symbols

    symbol_names()
    symbol_names(f)
returns the names of the variables defined in the system. If passed a function, it uses the function to limit the names returned.
    symbol_value(s)
takes a string, s, and returns the value of the variable with the name s. If s has more then one element a record is returned.
    symbol_set(name,value)
    symbol_set(rec)
sets the value for the variable named name to value (name must be a string). If a record is provided, rec, it maps the record fields to global variables.
    symbol_delete(name)
deletes the symbol called name (name must be a string).
    is_defined(name)
returns T if the variable called name (name must be a string) has been defined, otherwise returns F.

Manipulating Variable Arguments

    num_args(...)
returns the number of arguments with which it was invoked.
    nth_arg(n, ...)
returns the n'th argument with which is was invoked, numbering the first argument (i.e., n) as 0.
    missing( )
returns a boolean vector with T in each element which corresponds to a missing parameter.

Input and Output

    is_file(file)
check to see if the variable file is of file type.
    is_asciifile(filename)
return T if the file indicated by the filename string is an ASCII file.
    stat(filename, bytes=100, follow=F)
return information about the file indicated by the filename string.
    read(file,num=1,what='l')
read ASCII characters from a file.
    write(file, ... , sep='\n')
write one or more strings to file.
    fprintf(file, format, ... )
format one or more values using format and write to file.
    printf(format, ... )
format one or more values using format and output to user.
    readline(prompt='>>')
prompt and collect a string from the user.
    read_value(file)
reads a Glish value saved to the file file.
    write_value(value,file)
writes the value value to the file file so that a subsequent call to read_value() will recover the value.

Manipulating Agents

    create_agent()
returns a new agent value.
    client(command, ..., host=F, input=F,
           suspend=F, ping=F, async=F)
creates a new Glish client with the given options.
    shell(command, ..., host=F, input=F,
          suspend=F, ping=F, async=F)
either runs a shell command synchronously (async=F) and returns a string representing its output, or creates an asynchronous shell client async=T.
    sync(c)
waits until client c has processed all events/requests previously sent to it.
    relay(src, src_name, ref dest, dest_name="*")
relays any src_name events generated by src to dest, renaming them dest_name.
    relay_all(src, ref dest)
relays every event from src to dest, using the same name.
    birelay_event(ref agent1, ref agent2, name)
relays every name event generated by either agent1 or agent2 to the other agent.
    birelay_all( ref agent1, ref agent2 )
relays every event generated by either agent1 or agent2 to the other agent.
    current_whenever()
returns an index identifying the whenever statement whose body is currently (or was last) executed in response to an event.
    last_whenever_executed()
returns an index identifying the most-recently executed whenever statement.
    whenever_stmts(agent)
returns a record identifying the event names and whenever statement indices associated with agent.
    active_agents()
returns a record array listing currently active agents.
    bundle_events(a)
    bundle_events(a, size)
bundle up events for agent a so that can later be sent all at once.
    flush_events(a)
force all bundled events agent a to be sent, and stop bundling events for a.

Memory Usage

    sizeof(x)
return the amount of storage in bytes required by variable x.
    alloc_info()
return information about memory usage by Glish.


Global Variables

    pi
    e
approximations of the mathematical constants $ \pi$ and e.
    argv
holds a string vector giving the arguments with which the Glish script was run.
    environ
is a record whose fields correspond to each environment variable set when the Glish script was run.
    system
is an agent record giving information about the execution environment of the Glish system.
    script
is either an agent record if a Glish script is running as a client of another Glish script, or the boolean value F.


next up previous contents index
Next: Alphabetic Summary of Functions Up: Predefined Functions and Variables Previous: Global Variables   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15