langur

built-in functions

Built-in functions include the following.

general is to I/O
file number string regex
general regex
is to
I/O file
number string

general functions

  • all(LIST)
  • all(FUNCTION, LIST)
  • all(REGEX, LIST)
  • all(HASH)
  • all(FUNCTION, HASH)
  • all(REGEX, HASH)

returns Boolean indicating whether a validation FUNCTION or REGEX returns true for all values in an LIST or HASH

...or returns null when given an empty LIST or HASH

if no FUNCTION or REGEX used, compares based on truthiness

  • any(LIST)
  • any(FUNCTION, LIST)
  • any(REGEX, LIST)
  • any(HASH)
  • any(FUNCTION, HASH)
  • any(REGEX, HASH)

returns Boolean indicating whether a validation FUNCTION or REGEX returns true for any value in an LIST or HASH

...or returns null when given an empty LIST or HASH

if no FUNCTION or REGEX used, compares based on truthiness

  • benchmark(FUNCTION)
  • benchmark(FUNCTION, COUNT)

returns string representing time required to execute the FUNCTION, the number of times given by the COUNT (default 1)

The FUNCTION must be one that takes no parameters. COUNT must be a positive integer.

see also ticks()

  • count(LIST)
  • count(HASH)
  • count(FUNCTION, LIST)
  • count(REGEX, LIST)
  • count(FUNCTION, HASH)
  • count(REGEX, HASH)

if passed one argument, tests each value of LIST or HASH for truthiness

otherwise returns count of values that the FUNCTION or REGEX returns true for

see also filter(), any(), all()

  • execT(STRING)

executes a system command STRING, using a trusted source (not for use with user-provided data)

returns a result or throws an exception

see also execTH()

  • execTH(STRING)

executes a system command STRING, using a trusted source (not for use with user-provided data)

returns a hash instead of a result or exception

see also execT()

  • exit()
  • exit(CODE)
  • exit(BOOLEAN)
  • exit(CODE, ANYTHING)
  • exit(BOOLEAN, ANYTHING)

exits a script with an integer CODE (default 0), or with a system-specific generic code if not an integer (does not throw)

accepts a BOOLEAN in place of the code, true meaning success, returning 0, and false meaning failure and returning a system-specific generic code (1 on Linux)

accepts a second argument; only if code returned is non-zero, will write ANYTHING to standard error, appending a newline

  • filter(LIST)
  • filter(HASH)
  • filter(FUNCTION, LIST)
  • filter(REGEX, LIST)
  • filter(FUNCTION, HASH)
  • filter(REGEX, HASH)

if passed one argument, tests each value of LIST or HASH for truthiness

otherwise returns list or hash of values that the FUNCTION or REGEX returns true for

may return empty list or hash

see also count()

  • first(LIST)
  • first(STRING)
  • first(RANGE)

returns first element of the LIST, STRING, or RANGE

see also last()

  • fold(FUNCTION, LIST)
  • fold(FUNCTION, RANGE)
  • fold(FUNCTIONS, LIST)
  • fold(FUNCTIONS, RANGE)

returns value folded by the FUNCTION from the LIST or RANGE

example:
val .sum = fn(.list) { fold fn{+}, .list }

accepts integer range in place of an LIST, as implicit series

accepts an list of FUNCTIONS in place of FUNCTION, alternating between each for each value

see also foldfrom(), map(), zip(), mapX()

  • foldfrom(FUNCTION, INIT, LISTS...)
  • foldfrom(FUNCTIONS, INIT, LISTS...)

returns value folded by a FUNCTION from 1 or more LISTS, starting with an INIT value

FUNCTION parameter count == number of LISTS + 1 for the result (result as first parameter in FUNCTION)

accepts integer ranges in place of LISTS, as implicit series

accepts an list of FUNCTIONS in place of FUNCTION, alternating between each for each value

see also fold(), map(), zip(), mapX()

  • group(LIST)
  • group(FUNCTION, LIST)
  • group(INTEGER, LIST)

groups LIST elements into an list of lists, based on the return value of a FUNCTION or an INTEGER count (per grouping)

also accepts negative INTEGER to group "from the right"

if no FUNCTION or INTEGER used, gathers into 2 groups based on truthiness (always 2 groups and always true first, false second, even if one or both are empty)

see also groupby(), groupbyH()

  • groupby(LIST)
  • groupby(FUNCTION, LIST)

groups LIST elements into an list of lists of lists, based on the return value of a FUNCTION, including the value grouped upon

if no FUNCTION used, gathers into 2 groups based on truthiness (always 2 groups and always true first, false second, even if one or both are empty)

see also groupbyH(), group()

  • groupbyH(FUNCTION, LIST)

groups LIST elements into a hash of lists, based on the return value of a FUNCTION, using the values grouped upon as keys

see also groupby(), group()

  • haskey(LIST, INDEX)
  • haskey(STRING, INDEX)
  • haskey(HASH, INDEX)
  • haskey(RANGE, INDEX)
  • haskey(OTHER, INDEX)

checks if complete INDEX exists

INDEX may be anything valid (could include list of values, ranges, etc.)

returns Boolean if indexable, or null for OTHER

  • keys(HASH)
  • keys(LIST)
  • keys(STRING)
  • keys(RANGE)

returns list of keys from a HASH (in no guaranteed order), or the 1-based indices of an LIST, STRING, or RANGE

note: for a RANGE, it's a simple list of [1, 2]

  • last(LIST)
  • last(STRING)
  • last(RANGE)

returns last element of the LIST, STRING, or RANGE

see also first()

  • len(LIST)
  • len(HASH)
  • len(STRING)
  • len(RANGE)

returns the length (as integer) of an LIST, HASH, STRING, or RANGE

STRING length in code points

since RANGE is indexable and len() is related to indexing (except on a HASH), returns 2 for a RANGE (beginning and end)

  • less(LIST)
  • less(LIST, KEY)
  • less(LIST, KEYS)
  • less(LIST, RANGE)
  • less(STRING)
  • less(STRING, KEY)
  • less(STRING, KEYS)
  • less(STRING, RANGE)
  • less(HASH, KEY)
  • less(HASH, KEYS)

creates new list, string, or hash, removing the last element, or returns empty item if the length is already 0

...or leaving out by KEY or list of KEYS, or RANGE

does not alter the original LIST, STRING, or HASH

may return empty list, string, or hash

see also more() and rest()

  • map(FUNCTION, LISTS...)
  • map(FUNCTION, HASHES...)
  • map(FUNCTIONS, LISTS...)

returns list (or hash) of values mapped to a FUNCTION from 1 or more LISTS or HASHES

accepts integer ranges in place of LISTS, as implicit series

accepts an list of FUNCTIONS and no-ops (indicated by underscore) in place of FUNCTION, alternating between each for each value of an list

see also fold(), foldfrom(), zip(), mapX()

  • mapX(FUNCTION, LISTS...)

returns cross-mapped list of values mapped to a FUNCTION from 1 or more LISTS

accepts integer ranges in place of LISTS, as implicit series

anything not an list or range becomes an implicit 1-element list

see also map(), fold(), foldfrom(), zip()

  • more(LIST, ITEMS...)
  • more(HASH, HASHES...)
  • more(STRING, ITEMS...)

creates new list, hash, or string, adding 1 or more ITEMS or HASHES

does not alter the original LIST, HASH, or STRING

for a STRING, may add strings or code points

for a HASH, throws on duplicate keys (use concatenation to overwrite keys if desired)

see also less() and rest()

  • nn(LIST)
  • nn(LIST, ALT_VALUE)

returns first element from an LIST that is not null

returns ALT_VALUE if no suitable value found (an exception if no ALT_VALUE specified)

  • pseries(RANGE)
  • pseries(RANGE, INCREMENT)
  • pseries(NUMBER)
  • pseries(NUMBER, INCREMENT)

generates an ascending (or "positive") list of numbers from a RANGE and INCREMENT (default 1)

for descending RANGE, returns empty list

may use NUMBER as implicit 1-based range

RANGE and INCREMENT not limited to integers

see also series()

  • rest(LIST)
  • rest(STRING)

creates new list or string, removing the first element, or returns empty item if the length is already 0

does not alter the original LIST or STRING

may return empty list or string

see also more() and less()

  • reverse(LIST)
  • reverse(STRING)
  • reverse(HASH)
  • reverse(RANGE)
  • reverse(NUMBER)

reverses order of LIST or RANGE elements, or digits in a NUMBER

reverses STRING by graphemes

reverses keys/values of HASH if possible; throws if not possible

  • rotate(LIST)
  • rotate(LIST, DISTANCE)
  • rotate(INTEGER, DISTANCE, RANGE)

rotates LIST elements by the DISTANCE given (default 1)

positive DISTANCE rotates to the "left" and negative to the "right"

for an INTEGER, rotates within RANGE; if outside RANGE, passed through unaltered

  • series(RANGE)
  • series(RANGE, INCREMENT)
  • series(NUMBER)
  • series(NUMBER, INCREMENT)

generates an list of numbers from a RANGE and INCREMENT (default 1 or -1)

may use NUMBER as implicit 1-based range

RANGE and INCREMENT not limited to integers

see also pseries()

  • sleep(INTEGER)

waits the specified number of milliseconds

returns a bool (false if value less than 1)

  • sort(FUNCTION, LIST)
  • sort(LIST)
  • sort(FUNCTION, RANGE)
  • sort(RANGE)

returns a sorted list or range, comparing each element by a FUNCTION taking two variables and returning a Boolean such as fn{<}

alternatively, compares using the less than operator, taking a FUNCTION taking one variable and returing some value, or no function at all

  • ticks()

returns Unix ticks in nanoseconds

see also benchmark()

  • zip(LISTS...)
  • zip(FUNCTION, LISTS...)

returns new list built by interleaving LISTS

alternatively, takes a FUNCTION to determine set of elements to append

accepts integer ranges in place of LISTS

see also map(), fold(), foldfrom(), mapX()

number functions

  • abs(NUMBER)

returns the absolute value of a NUMBER

  • atan(NUMBER)

returns the arctangent of a NUMBER given in radians

see also tan(), sine(), cos()

  • ceiling(NUMBER)

returns the least integer equal to or greater than a NUMBER

see also floor()

  • cos(NUMBER)

returns the cosine of a NUMBER given in radians

see also sine(), tan(), atan()

  • floor(NUMBER)

returns the greatest integer equal to or less than a NUMBER

see also ceiling()

  • gcd(LIST)

returns the greatest common divisor from LIST of numbers

see also lcm()

  • lcm(LIST)

returns the least common multiple from LIST of numbers

see also gcd()

  • max(LIST)
  • max(HASH)
  • max(RANGE)
  • max(STRING)
  • max(FUNCTION)

returns the maximum item from an LIST, HASH, RANGE, STRING, or FUNCTION

for STRING, returns the maximum code point number

for FUNCTION, returns the maximum parameter count (-1 for no maximum)

see also min(), minmax()

  • mean(LIST)
  • mean(HASH)
  • mean(RANGE)

returns the mean (average) from an LIST, HASH, or RANGE of values

see also mid()

  • mid(LIST)
  • mid(HASH)
  • mid(RANGE)

returns the mid-point from an LIST, HASH, or RANGE of values

see also mean()

  • min(LIST)
  • min(HASH)
  • min(RANGE)
  • min(STRING)
  • min(FUNCTION)

returns the minimum item from an LIST, HASH, RANGE, STRING, or FUNCTION

for STRING, returns the minimum code point number

for FUNCTION, returns the minimum parameter count

see also max(), minmax()

  • minmax(LIST)
  • minmax(HASH)
  • minmax(RANGE)
  • minmax(STRING)
  • minmax(FUNCTION)

returns the minimum to maximum range of items from an LIST, HASH, RANGE, STRING, or FUNCTION

for STRING, returns the code point numbers

for FUNCTION, returns the parameter counts (-1 for no maximum)

see also max(), min()

  • random(INTEGER)
  • random(RANGE)
  • random(LIST)
  • random(HASH)
  • random(STRING)

for an INTEGER, returns 0 if 0, a random number from 1 to the INTEGER if positive, or -1 to the INTEGER if negative

for a non-empty LIST, HASH, or STRING, returns 1 element at random (code point for a STRING)

all numbers within limits of a signed 64-bit integer

  • round(NUMBER)
  • round(NUMBER, COUNT)
  • round(NUMBER, COUNT, ROUNDMODE)

rounds NUMBER to specified digit COUNT after decimal point (default 0)

accepts negative COUNT to indicate not to add extra padding zeroes

Rounding mode defaults to round half away from zero, and a rounding mode can be set.

see also trunc()

  • simplify(NUMBER)

simplifies NUMBER, removing trailing zeros

  • sine(NUMBER)

returns the sine of a NUMBER given in radians

see also cos(), tan(), atan()

  • tan(NUMBER)

returns the tangent of a NUMBER given in radians

see also atan(), sine(), cos()

  • trunc(NUMBER)
  • trunc(NUMBER, COUNT)

truncates NUMBER to specified digit COUNT after decimal point (default 0)

accepts negative COUNT to indicate not to add extra padding zeroes

see also round()

string functions

Some functions, such as split() and replace(), are listed under regex functions, though they aren't just for use with regex.

  • b2s(INTEGER)
  • b2s(INTEGER_LIST)

converts UTF-8 byte or byte list into a string

see also s2b(), s2cp(), s2gc(), cp2s(), s2s(), s2n()

  • cp2s(INTEGER)
  • cp2s(INTEGER_LIST)
  • cp2s(RANGE)

converts code points (integers), and grapheme clusters, into a string

accepts integer RANGE in place of list

also accepts embedded lists and ranges of integers (within INTEGER_LIST); could have an list of lists of integers representing grapheme clusters

see also s2cp(), s2gc(), s2s(), s2b(), b2s(), s2n()

  • join(LIST)
  • join(DELIMITER, LIST)

creates a string from LIST, using the specified DELIMITER string between each entry

uses auto-stringification on all elements of the LIST passed (so you don't have to explicitly map them to strings first)

if no DELIMITER passed, defaults to zero-length string

see also split(), cp2s()

  • lcase(STRING)
  • lcase(INTEGER)

converts STRING to lowercase

accepts an INTEGER representing a code point

see also ucase() and tcase()

  • ltrim(STRING)

removes preceding Unicode spacing

see also trim() and rtrim()

  • nfc(STRING)

converts STRING to normalization form NFC

see also nfd(), nfkc(), nfkd()

  • nfd(STRING)

converts STRING to normalization form NFD

see also nfc(), nfkc(), nfkd()

  • nfkc(STRING)

converts STRING to normalization form NFKC

see also nfc(), nfd(), nfkd()

  • nfkd(STRING)

converts STRING to normalization form NFKD

see also nfc(), nfd(), nfkc()

  • rtrim(STRING)

removes trailing Unicode spacing

see also trim() and ltrim()

  • s2b(STRING)

returns UTF-8 byte list

see also b2s(), s2cp(), s2gc(), cp2s(), s2s(), s2n()

  • s2cp(STRING)
  • s2cp(STRING, INDEX)
  • s2cp(STRING, INDEX, ALTERNATE)

returns code point (integer) or list of code points, or ALTERNATE value for an invalid INDEX

see also cp2s(), s2s(), s2b(), b2s(), s2n()

  • s2gc(STRING)

returns a list of code points and grapheme clusters (lists) from a string

see also cp2s(), s2cp(), s2s(), s2b(), b2s(), s2n()

  • s2n(STRING)
  • s2n(INTEGER)

returns list of numbers from a STRING or a single number from an INTEGER (code point), assuming base 36

... so that the letter A or a is 10 and Z or z is 35.

see also s2cp(), s2gc(), cp2s(), s2s(), s2b(), b2s()

  • s2s(STRING)
  • s2s(STRING, INDEX)
  • s2s(STRING, INDEX, ALTERNATE)

returns string built by index, or ALTERNATE value for an invalid INDEX

see also s2cp(), s2gc(), cp2s(), s2b(), b2s(), s2n()

  • tcase(STRING)
  • tcase(INTEGER)

converts STRING to titlecase

accepts an INTEGER representing a code point

see also ucase() and lcase()

  • trim(STRING)

removes preceding/trailing Unicode spacing

see also ltrim() and rtrim()

  • ucase(STRING)
  • ucase(INTEGER)

converts STRING to uppercase

accepts an INTEGER representing a code point

see also lcase() and tcase()

regex

The regex functions understand all regex types available in langur.

To generate a regex object for these functions, you use a regex literal (such as re/pattern/) or a compile function (such as reCompile()). You could also assign regex to a variable that may be passed to these functions. The regex is compiled before the functions see it.

For the pattern, some of these functions accept plain strings (not strictly regex functions).

These functions use auto-stringification on the argument to match. That's why they specify ANYTHING as an argument in the descriptions below.

  • index(REGEX, ANYTHING)
  • index(STRING, ANYTHING)
  • index(REGEX, ANYTHING, ALT_RETURN)
  • index(STRING, ANYTHING, ALT_RETURN)

returns 1-based code point range for match

for no match, returns null or ALT_RETURN value

  • indices(REGEX, ANYTHING)
  • indices(STRING, ANYTHING)
  • indices(REGEX, ANYTHING, MAX)
  • indices(STRING, ANYTHING, MAX)

returns list of ranges (empty list if no matches)

  • match(REGEX, ANYTHING)
  • match(REGEX, ANYTHING, ALT_RETURN)

returns matching string

for no match, returns null or ALT_RETURN value

  • matches(REGEX, ANYTHING)
  • matches(REGEX, ANYTHING, MAX)

returns list of matches (empty list if no matches)

  • matching(REGEX, ANYTHING)
  • matching(STRING, ANYTHING)

returns Boolean indicating whether there is a match

  • replace(ANYTHING, REGEX)
  • replace(ANYTHING, STRING)
  • replace(ANYTHING, REGEX, REPLACEMENT)
  • replace(ANYTHING, STRING, REPLACEMENT)
  • replace(ANYTHING, REGEX, FUNCTION)
  • replace(ANYTHING, STRING, FUNCTION)
  • replace(ANYTHING, REGEX, REPLACEMENT, MAX)
  • replace(ANYTHING, STRING, REPLACEMENT, MAX)
  • replace(ANYTHING, REGEX, FUNCTION, MAX)
  • replace(ANYTHING, STRING, FUNCTION, MAX)

returns string with replacements made progressively by REPLACEMENT string or by FUNCTION

used with REGEX, the REPLACEMENT string may contain submatches, using $1, $2, etc.

if no REPLACEMENT string or FUNCTION passed, defaults to zero-length string (replace with nothing)

may also use an list of replacement strings, functions, and no-ops, alternating between each in turn (except that using with REGEX doesn't allow multiple string replacements so far)

  • split(ANYTHING)
  • split(REGEX, ANYTHING)
  • split(STRING, ANYTHING)
  • split(INTEGER, ANYTHING)
  • split(REGEX, ANYTHING, MAX)
  • split(STRING, ANYTHING, MAX)
  • split(INTEGER, ANYTHING, MAX)

returns list of strings split by either a REGEX or plain STRING delimiter

if passed 1 argument, delimiter defaults to zero-length string (split into code point strings)

accepts INTEGER to split by (into code point strings); negative INTEGER splits "from the right"

see also join(), s2cp(), s2gc(), s2b(), s2n()

  • subindex(REGEX, ANYTHING)

returns list of submatch ranges (empty list if not a match)

  • subindices(REGEX, ANYTHING)
  • subindices(REGEX, ANYTHING, MAX)

returns list of lists of submatch ranges (empty list if no matches)

  • submatch(REGEX, ANYTHING)

returns list of submatches (empty list if not a match)

  • submatchH(REGEX, ANYTHING)

returns hash of whole match and submatches (empty hash if not a match)

includes whole match with key 0

includes named captures twice (once with string key and once with number key)

  • submatches(REGEX, ANYTHING)
  • submatches(REGEX, ANYTHING, MAX)

returns list of lists of submatches (empty list if no matches)

  • submatchesH(REGEX, ANYTHING)
  • submatchesH(REGEX, ANYTHING, MAX)

returns list of hashes of whole matches and submatches (empty list if no matches)

includes whole match with key 0

includes named captures twice (once with string key and once with number key)

  • reCompile(STRING)

returns re2 regex compiled from a pattern STRING

  • reEsc(ANYTHING)

converts ANYTHING to a string, escapes re2 regex metacharacters and returns string

progressive matching

What is often called "global" matching we're calling "progressive." You can limit the results of these functions by passing a maximum count.

functions progressive?
matching, match, submatch, submatchH, index, subindex no
matches, submatches, submatchesH, indices, subindices, split, replace yes

type checking

Use the is and is not operators with type names to verify a type. This is covered on the type page.

type conversion

Use a call on a type name as shown below.

These convert, or attempt to convert a value to another type. Some of them may throw exceptions.

  • datetime(STRING)
  • datetime(STRING, FORMAT)
  • datetime(HASH)
  • datetime(NANOSECONDS)
  • datetime(DATETIME)
  • datetime(DATETIME, TIMEZONE)

generates a date-time value

given a STRING without a FORMAT, attempts to parse as it does for date-time literals (ISO 8601)

given a STRING with a FORMAT string, attempts to parse by the Go time package

(Note that, having tested the time package with Go 1.14.1 on Linux, it does not parse all time zone abbreviations, such as EST, correctly. It not only fails to parse them, but does so silently.)

given a DATETIME without a TIMEZONE, it is passed through unaltered

TIMEZONE string may be anything recognized by the Go time package, such as "US/Arizona", or may be an empty string (local time zone) or "Z" (UTC), or a string offset, such as "-07:00"

see also hash(), number(), string()

  • duration(STRING)
  • duration(HASH)
  • duration(NANOSECONDS)
  • duration(DURATION)

generates a duration value

given a STRING without a FORMAT, attempts to parse as it does for duration literals (ISO 8601)

given a DURATION, it is passed through unaltered

see also hash(), number(), string()

  • hash()
  • hash(HASH)
  • hash(KEY_VALUE_LIST)
  • hash(KEYS_LIST, VALUES_LIST)
  • hash(DATETIME)
  • hash(DURATION)

attempts to create a hash from a single list of keys and values in series, or from parallel lists of keys and values, or from a DATETIME or DURATION value

will pass through a HASH value

accepts ranges in place of lists

with no arguments, will return an empty hash

see also keys(), datetime()

  • number(NUMBER)
  • number(BOOLEAN)
  • number(STRING)
  • number(STRING, BASE)
  • number(DATETIME)
  • number(DURATION)
  • number(RANGE)

attempts to convert value to a number

for a BOOLEAN, returns 1 for true and 0 for false

for a DATETIME, returns Unix nanoseconds since the start of January 1, 1970 UTC

for a DURATION, converts to nanoseconds (as well as possible); years and months hard to define in this way

accepts a numeric RANGE, returning a prospective count for an integer range (if were to be converted to an list of elements)

see also string(), s2n(), datetime()

  • string(ANYTHING)
  • string(INTEGER, BASE)
  • string(DATETIME)
  • string(DATETIME, FORMAT)
  • string(DURATION)

converts to and returns string

does not throw if no BASE given

for a DATETIME with no FORMAT, returns ISO 8601/RFC 3339 timestamp

for a DURATION, returns ISO 8601 duration string

see also number(), datetime()

  • bool(ANYTHING)

converts to a Boolean based on the truthiness of value

I/O functions

  • read()
  • read(PROMPT)
  • read(PROMPT, REGEX)
  • read(PROMPT, FUNCTION)
  • read(PROMPT, REGEX, ERR_STRING)
  • read(PROMPT, FUNCTION, ERR_STRING)
  • read(PROMPT, REGEX, ERR_STRING, MAX)
  • read(PROMPT, FUNCTION, ERR_STRING, MAX)
  • read(PROMPT, REGEX, ERR_STRING, MAX, ALT_VALUE)
  • read(PROMPT, FUNCTION, ERR_STRING, MAX, ALT_VALUE)

reads a string from standard in

may print a PROMPT string to standard out for each attempt

may use validation via a FUNCTION taking one argument such as fn .in: len(.in) < 20 or a REGEX such as RE/^\d+$/

prints an ERR_STRING if validation fails (default empty string)

tries the MAX number of times given (default 1; -1 == infinite)

may return an ALT_VALUE on final failure instead of an exception

  • write(ARGS...)

writes a string of all arguments to standard out

  • writeErr(ARGS...)

writes a string of all arguments to standard error

  • writeln(ARGS...)

writes a string of all arguments to standard out, appending one system newline

  • writelnErr(ARGS...)

writes a string of all arguments to standard error, appending one system newline

file functions

New file permissions, if not passed, default to the file permissions mode, which defaults to 664 (in base 8). In langur, you would write this as 8x664 (NOT 0664 or 664, which would give the wrong number (as base 10)).

  • appendfile(FILENAME, STRING)
  • appendfile(FILENAME, STRING, PERMISSIONS)

appends STRING to given file; creates file if it doesn't exist

see also writefile()

  • cd()
  • cd(PATH)

changes working directory of the current script to the PATH or throws an exception

returns the present working directory

has no effect on parent processes

  • prop(PATH)

returns a hash of properties from PATH file or directory, if it can be determined at time of execution; otherwise returns null

  • readfile(FILENAME)

returns string from given file

  • writefile(FILENAME, STRING)
  • writefile(FILENAME, STRING, PERMISSIONS)

writes STRING to given file

see also appendfile()