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

Function Summary by Category

  Here we summarize 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_record(x)
    is_function(x)
    is_agent(x)
    is_numeric(x)
    is_fail(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.
    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 argument must be numeric.
    array(init, ...)
creates an array initialized to init and with dimensions of length specified in the subsequent parameters.
    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.

Manipulating Symbols

    symbol_names()
    symbol_names(f)
returns the names of the variables defined in the system. If passed a function, it will use 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.

Reading and Writing Values

    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 the currently active agents.

Global Variables

 

    pi
    e
approximations of the mathematical constants tex2html_wrap_inline15694 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

Thu Nov 13 16:44:05 EST 1997