Introduction

SLI is the simulation language of the NEST simulation system. SLI is a stack oriented language, i.e. each command expects to find its arguments on the stack. When a SLI command is executed, it usually removes all arguments from the stack and pushes one or more results back on the stack.

This document presents a directory of the most important SLI operators, grouped into sections. Since this document is not automatically generated from the help pages, it might not contain the latest additions to SLI.

The on-line help system

Layout of help pages

For most SLI commands, there exists help information which can be viewed either as plain ASCII text or in HTML-format. The structure of a help entry resembles that of a UNIX mamual page. It consists of several sections which are explained below:

Name:

[namespace::]Command

Synopsis:

arg1 ... argn Command -> res1 ... resn

arg1

argn

argn

->

resn

Parameters:

[result]

Description:

Options:

SetOptions

namespace::

Examples:

Variants:

Bugs:

Diagnostics:

Author:

FirstVersion:

Remarks:

Availability:

References:

SeeAlso:

Source:

Accessing the on-line help

The following commands are available to access NEST's on-line help facilities.

help Display help for a given symbol. helpdesk Open the on-line help main page in an HTML browser. helpindex Display a list of all documented commands. page The pager program to use for help output. apropos Search the command index for a regular expression.

Looking at node, networks, and connectivity

Navigating the network

CurrentSubnet Return the GID of the current network node. ChangeSubnet Change the curent working subnet to a specified position. PrintNetwork Print network tree in readable form. NetworkDimensions Returns an array with the dimensions of a structured subnet. GetGlobalNodes Return IDs of all nodes of a subnet. GetGlobalLeaves Return IDs of all leaves of a subnet. GetGlobalChildren Return IDs of all immediate child nodes of a subnet. GetLocalNodes Return IDs of all nodes of a subnet local to the MPI process executing the command. GetLocalLeaves Return IDs of all leaves of a subnet local to the MPI process executing the command. GetLocalChildren Return IDs of all immediate child nodes of a subnet local to the MPI process executing the command.

Investigating connectivity

Setting and retrieving parameters of network elements

SetStatus Modify status of an element. GetStatus Return the status dictionary of an element. ShowStatus Show the status dictionary of a network node. type Return the type of an element. ResetKernel Put the simulation kernel back to its initial state. ResetNetwork Reset the dynamic state of the network. reset Reset dictionary stack and clear the userdict.

Counting stack levels

count Count the number of objects on the stack. counttomark Count number of objects on the stack from top to marker. mark Push a mark-object on the stack.

Copying stack elements

dup Duplicate the object which is on top of the stack. over Copy stack object at level 1. copy Copy the first n stack levels. pick Copy object from stack level n. index Copy object from stack level n.

Removing stack elements

pop Pop the top object off the stack. npop Pop n object off the stack. clear Clear the entire stack.

Rearranging stack elements

exch Exchange the order of the first two stack objects. roll Roll a portion n stack levels k times. rolld Roll the three top stack elements downwards. rollu Roll the three top stack elements upwards. rot Rotate entire stack contents.

Execution-stack access

execstack Return the contents of the execution stack as array. restoreestack Restore the execution stack from an array.

Arithmetic functions

abs Absolute value of a number. add Add two numbers or vectors. sub Subtract two numbers or vectors. mul Multiply two numbers or vectors (point-wise). div Divide two numbers or vectors (point-wise). inv Compute 1/x. mod Compute the modulo of two integer numbers. neg Reverse sign of a number. ceil Return nearest integer larger than the argument. round Round double to the nearest integer. trunc Truncate decimals of a double. floor Return nearest integer smaller than the argument. pow Raise a number to a power. sqr Compute the square of a number. sqrt Compute the square root of a non-negative number. exp Calculate the exponential of double number. ln Calculate natural logarithm of double number. log Calculate decadic logarithm of double number. frexp Decomposes its argument into an exponent of 2 and a factor. modf Decomposes its argument into fractional and integral part. cos Calculate the cosine of double number. sin Calculate the sine of double number. max Return the greater of two values. min Return the smaller of two values.

Boolean functions

Comparison functions

eq Test two objects for equality. gt Test if one object is greater than another object. geq Test if one object is greater or equal than another object. lt Test if one object is less than another object. leq Test if one object is less or equal than another object. neq Test two objects for inequality. Min Returns the smallest element of an array. Max Returns the largest element of an array.

Boolean operators

and Logical and operator. or Logical or operator. not Logical not operator. xor Logical xor operator.

Statistics

Min Returns the smallest element of an array. Max Returns the largest element of an array. Total Returns the sum of the elements of an array. Mean Returns the mean of the elements of an array. Variance Returns the unbiased variance of the elements of an array. StandardDeviation Returns the standard deviation of the element of an array.

Arrays, vectors, and matrices

Construction

array Construct array with n zeros (PS). arraystore Pops the first n elements of the stack into an array. LayoutArray Create a multi-dimensional array. Range Generate array with range of numbers. Table Generate an array according to a given function. ReadList Read a list of specified format from a stream. GaborPatch Create a two-dimensional array filled with values from the Gabor function. GaussPatch Create a two-dimensional array filled with values from the Gauss function.

Insertion

put Put indexed object into container. insert Insert an object in a container at a specific position. insertelement Insert an element to a container at a specific position. join Join two containers of the same type. JoinTo Join with container referenced by l-value. append Append object to container. AppendTo Append to container referenced by l-value. prepend Attach an object to the front of a container.

Inspecting an array or matrix

empty Tests if a string or array is empty. length Counts elements of an object. size Returns the size of an array/string. GetMin Get minimal element. GetMax Get maximal element. ArrayQ Returns true if top object is an array. MatrixQ Test if a SLI array is a (hyper-rectengular) matrix. Dimensions Determine dimenstions of a (hyper-rectangular) SLI array. TensorRank Estimate the rank of a tensor.

Retrieving elements from an array

get Retrieve indexed Object from a container. Part Returns parts of an array. Take Extract sequences from an array. getinterval Return a subsequence of a container. erase Deletes a subsequece of a container. First Return the first element of an array. Last Return the last element of an array. Rest Remove the first element of an array and return the rest. Select Reduces an array to elements which fulfill a criterion. Sort Sorts a homogeneous array of doubles. arrayload Pushes array elements followed by number of elements. area Return array of indices defining a 2d subarea of a 2d array. area2 Return array of indices defining a 2d subarea of a 2d array.

Removing and replacing elements

putinterval Replace sections of an array/string (PS). erase Deletes a subsequece of a container. replace Replace a section of a container by a new sequence. ReplaceOccurrences Replace the occurences of a key in a container. breakup Break a string or an array at given Substrings or SubArrays. trim Delete leading/trailing elements in a container.

Operations on lists and arrays

Partition Partition list into n element pieces. Flatten Flatten out a nested list. Reform Reform the dimensions of a hyperrectengular array. Select Reduces an array to elements which fulfill a criterion. Split Splits array into subarrays of sequences of identical elements. MergeLists Merges sorted lists. MemberQ Checks if array contains a specific element. HasDifferentMemberQ Checks if array contains an element different from given value.

Functional operations on lists and arrays

Map Apply a procedure to each element of a list or string. MapAt Apply a procedure to some elements of a list or string. MapIndexed Apply a function to each element of a list/string. MapThread Apply a procedure to to corresponding elements of n arrays. FixedPoint Apply a procedure repeatedly until the result is an invariant. NestList Gives a list of the results of applying f to x 0 through n times. Nest Apply a function n times. FoldList Gives a list of the results of repeatedly applying a function with two parameters. Fold Result of repeatedly applying a function with two arguments. ScanThread Apply a procedure to corresponding elements of n arrays, not returing results. forall Call a procedure for each element of a list/string. forallindexed Call a procedure for each element of a list/string. EdgeClip Clip 2-d array indices at array edges. EdgeTruncate Truncate 2-d array indices at array edges. EdgeWrap Wrap 2-d array indices around edges (toriodal). IndexWrap Project a cyclic index value onto interval [0,N).

Arrays as vectors and matrices

Dimensions and rank

MatrixQ Test whether a nested array is a matrix. Dimensions Determine dimensions of an array. TensorRank Determine the level to which an array is a full vector.

Operations on vectors and matrices

add Add two numbers or vectors. sub Subtract two numbers or vectors. mul Multiply two numbers or vectors (point-wise). div Divide two numbers or vectors (point-wise). Dot Product of vectors, matrices, and tensors. Plus Sum of all vector components. Times Product of all vector components. Transpose Transposes the first two levels of its argument. reverse Reverse a string or array. rotate Rotate an array. OuterProduct Outer product.

Memory management

capacity Returns the capacity of an array. reserve Bring an array to a certain capacity. resize Change the internal size of an array. shrink Reduce the capacity of an array to its minimum.

Conversion

Insertion

length Counts elements of an object. put Put indexed object into container. putinterval Replace sections of an array/string (PS). insert Insert an object in a container at a specific position. insertelement Insert an element to a container at a specific position. prepend Attach an object to the front of a container. append. Append object to container. join Join two containers of the same type.

Retrieving characters and substrings

empty Tests if a string or array is empty. get Lookup indexed Object of a container. getinterval Return a subsequence of a container. erase Deletes a subsequece of a container. First Return the first element of an array/string. Last Return the last element of an array/string. Rest Remove the first element of an array/string and return the rest. search Search for a sequence in an array or string. searchif Check wether a substring is contained within a string.

Removing and replacing

erase Deletes a subsequece of a container. replace Replace a section of a container by a new sequence. ReplaceOccurrences replace the occurences of a key in a container. breakup Break a string or an array at given sub-strings or sub-arrays. trim Delete leading/trailing elements in a container.

Operations on strings

empty Tests if a string or array is empty. length Counts elements of an object. size Returns the size of an array/string. forall Call a procedure for each element of a list/string. forallindexed Call a procedure for each element of a list/string. Map Apply a procedure to each element of a list or string. MapIndexed Apply a function to each element of a list/string. reverse Reverse a string or array. ToUppercase Convert a string to upper case. ToLowercase Convert a string to lower case.

Conversion

Insertion and lookup

using Add a namespace (or dictionary) to the local scope, keeping the current dictionary. endusing Close the scope of a 'using' context. get Lookup indexed Object of a container. call Execute object from a dictionary (or namespace, see below). put Put indexed object into container. put_d Add an entry to a dictionary. known Check whether a name is defined in a dictionary. info Display the contents of a dictionary. info_ds Print contents of all dictionaries on the dicitonary stack to stream. topinfo_d Print contents of top dictionary to stream. length Counts elements of a container object. SubsetQ Test if one dictionary is a subset of another.

Key removal

undef Remove a key from a dictionary. cleardict Clears the contents of a dictionary.

Dictionary Stack

dictstack Return current dictionary stack as array. begin Open a dictionary. end Closes the current dictionary. currentdict Return topmost dictionary of the dictionary stack. lookup Search for a key in each dictionay on the dictionary stack. who List contents of the top-level dicitonary. whos List contents of all dictionaries on the dicitonary stack. countdictstack Return number of dictionaries on the dictionary stack. cleardictstack Pop all non-standard dictionaries of the stack.

Namespaces

Dictionaries can be used to limit names to a certain scope. This is useful for logical grouping, and to prevent name conflicts, very much like the use of namespaces in C++. Furthermore, it keeps the system dictionary from being littered.

When refering to a variable or routine of limited scope, its scope shall be indicated by the notation namespace::name (e.g. arr::Reform). If no namespace is specified, systict:: is implicitely assumed, meaning unlimited scope.

Note: Please note that the notation namespace::name is not yet supported in program code. Use the command call instead.

namespace Open or create a namespace dictionary. call Execute object from a namespace (or dictionary, see above). :: Execute a symbol from a nested namespace.

Names, functions, and variabes

Defining variables and functions

def Define a variable or function. Set Same as def with reversed arguments. undef Remove a key from a dictionary. SLIFunctionWrapper Define a SLI function with lots of comfort.

Show defined variables and functions

who List contents of the top-level dicitonary. whos List contents of all dictionaries on the dicitonary stack. lookup Search for a key in each dictionay on the dictionary stack. known Check whether a name is defined in a dictionary.

Names and scoping

begin Open a dictionary. end Closes the current dictionary. lookup Search for a key in each dictionay on the dictionary stack. load Search for a key in each dictionay on the dictionary stack.

Loops

Infinite loops

Loops with counters

for Execute a procedure for a sequence of numbers. repeat Execute a procedure n times. FindRoot Numerically find a root in an interval. exit Exit a loop construct.

Loops over containers

forall Call a procedure for each element of a list/string. forallindexed Call a procedure for each element of a list/string. Map Apply a procedure to each element of a list or string. MapIndexed Apply a function to each element of a list/string. MapThread Apply a procedure to corresponding elements of n arrays, returning the result. ScanThread Apply a procedure to corresponding elements of n arrays, not returing results. NestList Gives a list of the results of applying f to x 0 through n times. FoldList Repeatedly apply a function with two parameters. exit Exit a loop construct.

Functions and procedures

Object oriented techniques

Type checking

Accessing type information

type Return the type of an object. typeinfo Return the type of an object. LiteralQ Returns true if top object is a literal. NumberQ Returns true if top object is a number (int or double). StringQ Returns true if top object is a string.

Type tries

A type-trie is a lookup structure which can be used to implement automatic type checking as well as operator overloading.

def Define a variable or function. SLIFunctionWrapper Define a SLI function with lots of comfort. trie Create a new type-trie object. addtotrie Add a function variant to a trie-object. cva Convert dictionary/trie to array. cva_t Converts a type trie to an equivalent array. cvt_a Converts an array to the equivalent type trie.

Optimization

Error handling and debugging

If an error occurs, execution is usually interrupted and a diagnostic message is printed. In most cases, the stack is restored to the state where it was immediately before the command that raised the error was called.

If the error was raised from within a procedure, the stack might not be restored to the state before the procedure was called.

handleerror Default error handler. stop Raise a stop signal. stopped Returns true if execution was stopped by stop. raiseerror Raise an error to the system. raiseagain Re-raise the last error. resume Resume interrupted SLI program after a system signal. setguard Limit the number of interpreter cycles. break Interrupt the execution of a procedure for inspection. continue Continue an interrupted procedure. assert Assert that procedure returns true. currentname Returns the most recently resolved name. debug.sli Debugging support for SLI.

Opening and Closing

file Opens file for reading or writing. ifstream Open file stream for reading. xifstream Create an executable input-stream. searchfile Tries to open a file for reading using the search-path. searchifstream Searches SLI's search path for a file. ofstream Open a file stream for writing. ofsopen Open an existing file for appending or writing. osstream Create a string-stream object. pipe Open up a pipe. mkfifo Create a FIFO special file (named pipe). close Close a stream. tmpnam Return valid nonexisting file name. dup2 Duplicate a filestream's file descriptor onto another's. isatty Determine if a stream is connected to a terminal.

Reading from streams

Checking for data

setNONBLOCK Switch between blocking and non-blocking I/O. in_avail Check for available data in an input stream's buffer. available Check if data is available from an istream. ignore Ignore any waiting data on an istream.

Unformatted string input

getc Read single character from input stream. gets Read white space terminated string from stream. getline Read a newline terminated string from an input stream. readline Read and edit a line from standard input. GNUreadline Read and edit a line from standard input. GNUaddhistory Add a string to the readline-history. oldgetline "Old", ignorant version of getline.

Formatted input

str Retrieve a string from a string-stream. token Read a token from a stream or string. token_is Read a token from an input stream. token_s Read a token from a string. Read Read an object of a certain type from a stream. ReadDouble Read a double from a stream. ReadInt Read an integer from a stream. ReadList Read a list of specified format from a stream. ReadWord Read white space terminated string from stream. ReadModes Dictionary with type specifiers for read functions.

Formatted Output

Writing to streams

print Print object to a stream. pprint Pretty print object to a stream. endl Line break. flush Force the buffer of a stream to be flushed. setprecision Set precision for decimal place of a stream.

Handling flags of streams

iclear Clear the state-flags of input stream. oclear Clear the state-flags of output stream. ifail Check the "fail"-flag of an input stream. ieof Check the "eof"-flag of an input stream. oeof Check the "eof"-flag of an output stream. eof Check eof status of a stream. igood Check the "good"-flag of a stream. ogood Check the "good"-flag of an output stream. good Check good status of a stream.

Process control

Executing UNIX commands and external programs

system Execute a UNIX command in a parallel process. spawn Spawn a UNIX process and redirect stdin and stdout. shpawn Spawn a UNIX process using a shell and redirect stdin and stdout. sysexec Transfer control to a UNIX-command. kill Send a signal to another process.

Low-level process control

exec Execute an object. ctermid Return the path to the controlling terminal of the process. fork Create a child process of SLI. spawn Spawn a UNIX process and redirect stdin and stdout. shpawn Spawn a UNIX process using a shell and redirect stdin and stdout. spoon Execute a parallel SLI-process. kill Send a signal to another process. wait Wait for any child process to terminate. waitPID Wait or check for a child process to terminate. getPGRP Get process group ID of the current process. getPID Get ID of the current process.

Accessing the process environment

environment Return the environment of the current SLI process. setenvironment Set the environment of the current SLI process. getenv Evaluates if a string is an evironment variable.