Methods

!=

!=(a:Any, b:Any)

Inequality operator

!==

!==(a:Any, b:Any)

Non-sameness operator

"$*"

"$*"(components:Arr)

String expansion handler. Called automatically for every double-quoted string that has $* components.

$()

$()(c:Command)

Execute an external command. Waits for the command to finish unless "&" is specified.

$()(c:Command)

Enables "nofail" command prefix.

%

%(a:Int, b:Int)

Modulus

%(x:Any, cb:Fun)

Each operator. Same as calling x.each(cb)

%()

%()(c:Command)

Returns c, wihout any processing. Convenient way to pass ready-to-run Command as an argument

*

*(a:Real, b:Real)

Multiplication

*(a:Int, b:Int)

Multiplication

*(arr:Arr, n:Int)

Repeat all elements in arr n times

*(a:Arr, b:Arr)

Cartesian product

*(s:Str, n:Int)

Repeat string n times

*(cb:Fun, n:Int)

Call cb n times without any parameters and accumulate the results.

+

+(a:Real, b:Real)

Addition

+(a:Arr, b:Arr)

Array concatenation.

+(a:Int, b:Int)

Addition

+(s1:Str, s2:Str)

Concatenate strings

+(f:Fun, g:Fun)

Compose functions

+(a:Hash, b:Hash)

Add Hashes. Builds new hash with key-value pairs from both a and b. If same key is present in both a and b, the value from b is used.

+(s:Str, a:Arr)

Prepend each line in a with s

+(a:Arr, s:Str)

Append s to each line in a

+?

+?(a:Any, b:Any)

-

-(a:Real, b:Real)

Subtraction

-(a:Int, b:Int)

Subtraction

-(a:Arr, b:Arr)

Filter out all values in a that are also in b

-(s:Str, pfx:Pfx)

Return string without the prefix. Throws MatchFail if pfx is MustPfx but s does not start with it.

-(s:Str, sfx:Sfx)

Return string without the suffix. Throws MatchFail if pfx is MustSfx but s does not end with it.

-(s:Str, r:RegExp)

Returns the string with one occurrence of regexp cut out of it. Throws InvalidArgument if s does not contain r.

.

.(regexp:RegExp, attr:Str)

Get attributes of a RegExp. Throws AttrNotFound if attr is not one of the allowed values. You should not use this directly. Use "~" and "~~" operators.

.(pa:c_pthread_attr_t, attr:Str)

.(obj:BasicType, attr:Str)

Get BasicType (Int, Arr, Hash, ...) attribute. Throws AttrNotFound.

.(obj:NormalType, attr:Str)

Get NormalType (a type that is typically defined by user) attribute. Throws AttrNotFound.

.(obj:NormalTypeInstance, attr:Str)

Get NormalType (a type that is typically defined by user) instance attribute. Throws AttrNotFound.

.(hl:HashLike, k:Any)

.(h:Hash, attr:Str)

Get hash key.

.(a:Arr, attr:Str)

Return array made of given attribute of each element of given array

.(p:Process, attr:Str)

Get process "stdout"

.(p:Process, attr:Str)

Get process "stderr"

..

..(start:Any, end:Any)

Constructs open-open predicate range

..(start:Num, end:Any)

Constructs closed-open numerical range

...

...(start:Any, end:Any)

Constructs closed-closed predicate range

...(start:Num, end:Any)

Constructs closed-closed numerical range

.=

.=(obj:NormalTypeInstance, attr:Str, v:Any)

Set Normal type (a type that is typically defined by user) instance attribute. Throws AttrNotFound.

.=(hl:HashLike, k:Any, v:Any)

.=(h:Hash, attr:Str, v:Any)

Set hash key.

.=(p:Process, attr:Str, v:Any)

Set process "stdout"

.=(p:Process, attr:Str, v:Any)

Set process "stderr"

/

/(a:Real, b:Real)

Division

/(a:Int, b:Int)

Division

/(x:Any, mapper:Fun)

Map operator. Same as calling x.map(mapper)

/(a:Str, b:Str)

Concatenate two path parts using STDLIB_PATH_SEP (currently "/") but should be platform-specific later.

/(a:Str, b:Str)

Concatenate two path parts using STDLIB_PATH_SEP (currently "/") but should be platform-specific later.

/(a:Str, b:Str)

Concatenate two path parts using STDLIB_PATH_SEP (currently "/") but should be platform-specific later.

/(a:Path, b:Path)

Concatenate two Path-s using /(a:Str, b:Str)

//

//(regexp:Str, flags:Str)

Regular expression constructor. Called by NGS when /myregex/ syntax is used.

::

::(nti:NormalTypeInstance, k:Any)

::(h:Hash, k:Any)

::=

::=(nti:NormalTypeInstance, k:Any, v:Any)

::=(h:Hash, k:Any, v:Any)

<

<(a:Real, b:Real)

Less-than comparison

<(a:Int, b:Int)

Less-than comparison

<=

<=(a:Real, b:Real)

Less-than-or-equal comparison

<=(a:Int, b:Int)

Less-than-or-equal comparison

<=(a:Str, b:Str)

Case sensitive LessThan or Equal comparison for strings

==

==(a:Any, b:Any)

==(a:Type, b:Type)

Types equality comparison. Implemented as sameness comparison.

==(a:Closure, b:Closure)

Closure equality comparison. Implemented as sameness comparison.

==(a:Real, b:Real)

Equality comparison. Using this operator/function is not recommended. See http://how-to.wikia.com/wiki/Howto_compare_floating_point_numbers_in_the_C_programming_language .

==(a:Bool, b:Bool)

Compare booleans

==(a:Str, b:Str)

Equality comparison

==(a:Int, b:Int)

Equality comparison

==(a:NormalTypeInstance, b:NormalTypeInstance)

Equaity test for normal type instances: must be of same type and have same attributes and their values

==(a:Null, b:Any)

Comparison to null

==(a:Any, b:Null)

Comparison to null

==(a:Null, b:Null)

Comparison to null

==(a:Arr, b:Arr)

Arrays equality test. True if arrays are of the same length and all elements are equal (==)

==(a:Hash, b:Hash)

Compare two Hashes. Hashes must have same keys with same values in same order to return true.

==(b1:Box, b2:Box)

Compare boxes. Empty boxes and boxes with same content are considered to be equal.

==(a:RouteBox, b:RouteBox)

==(a:IpPermBox, b:IpPermBox)

===

===(a:Any, b:Any)

Sameness comparison.

>

>(a:Real, b:Real)

Greater-than comparison

>(a:Int, b:Int)

Greater-than comparison

>=

>=(a:Real, b:Real)

Greater-than-or-equal comparison

>=(a:Int, b:Int)

Greater-than-or-equal comparison

?

?(x:Any, predicate:Fun)

Filter operator. Same as calling x.filter(predicate)

[]

[](lib:CLib, symbol:Str)

Unfinished feature. Don't use!

[](arr:Arr, range:NumRange)

[](arr:Arr, idx:Int)

[](s:Str, range:NumRange)

Get substring

[](h:Hash, k:Any)

Get hash value by key. Throws KeyNotFound.

[](al:ArrLike, idx:Int)

Set element in the underlying array.

[](hl:HashLike, k:Any)

[](arr:Arr, idx:Int)

Get array element by index from the end

[](arr:Arr, r:NumRange)

Get array elements at specified indexes. Indexes specified by NumRange.

[](arr:Arr, r:PredRange)

Extract array elements between the element that matches r.start and the element that matches r.end . Starting and ending elements are optionally included, depending on r.include_start and r.include_end .

[](arr:Arr, indexes:Arr)

Get array elements at specified indexes.

[](s:Str, i:Int)

Get given character (currently byte) of the string

[](s:Str, i:Int)

Get given character (currently byte) of the string. TODO: Document InvalidArgument exception.

[](s:Str, r:NumRange)

Get a substring. Indexes in s are specified by NumRange.

[](my:MatchY, idx:Int)

Convenience method to access matches in MatchY

[](s:Str, r:RegExp)

Get substring of a string that corresponds to first match of given regular expression %EX "x10ab20c30y"[/[0-9]+/] # "10"

[]=

[]=(arr:Arr, range:NumRange, replacement:Arr)

[]=(arr:Arr, idx:Int, v:Any)

[]=(s:Str, range:NumRange, replacement:Str)

Change substring

[]=(h:Hash, k:Any, v:Any)

Set hash value.

[]=(al:ArrLike, idx:Int, x:Any)

Get element from the underlying array.

[]=(hl:HashLike, k:Any, v:Any)

\

\(x:Any, f:Fun)

Call operator. Same as calling f(x)

``

``(c:Command)

Get command standard output. Similar to bash.

````

````(c:Command)

Get command standard output and parse() it.

acquire

acquire(l:Lock)

acquire(l:Lock, cb:Fun)

all

all(e:Eachable, predicate:Any)

Check whether all elements in arr satisfy the given predicate.

any

any(e:Eachable1, predicate:Any)

Check whether there is any element in arr that satisfies the given predicate. TODO: Make it work on anything with Eachable2 too.

any(b:Box, predicate:Any)

Test Box value

Arg

Arg(x:Real)

Arg(x:Int)

Arg(x:Str)

args

args()

Get function arguments

Argv

Argv(h:Hash)

ArgvMatcher

ArgvMatcher(option:Str, value:Any, f:Closure)

Sets ARGV matching option.

Arr

Arr(h:Hash)

Make Arr from Hash. Each key/value pair becomes two-items array:

Arr(arr:Arr)

Make Arr from Arr. A no-op.

Arr(r:Eachable1)

Convert range to an array

Arr(fb:FullBox)

Convert FullBox to array

Arr(eb:EmptyBox)

Convert EmptyBox to array

Arr(t:TextCollector)

assert

assert(condition:Bool, msg:Str)

Throws AssertFail with givens message if condition is false

assert(condition:Bool)

Throws AssertFail if condition is false

assert(condition:Any, *args:Arr)

assert_array

assert_array(actual:Any, title:Any=null)

assert_base

assert_base(actual:Any, expected:Any, comparison:Any, display_comparison:Any, title:Any, ok_prefix:Any=)

assert_eq

assert_eq(actual:Any, expected:Any, title:Any)

assert_exit_code

assert_exit_code(p:Process, expected:Int, title:Any=null)

assert_has

assert_has(actual:Any, expected:Any, title:Any=null)

assert_hash

assert_hash(actual:Any, title:Any=null)

assert_hash_keys

assert_hash_keys(actual:Any, expected:Arr, title:Any=null)

assert_hash_keys_values

assert_hash_keys_values(actual:Any, expected:Hash, title:Any=null)

assert_min_len

assert_min_len(actual:Any, expected:Any, title:Any=null)

assert_output_has

assert_output_has(p:Process, expected:Any, title:Any=null)

assert_path_exists

assert_path_exists(p:Any, title:Any=Path exists)

assert_resolvable

assert_resolvable(h:Str, title:Any=Resolve host, times:Any=45, sleep:Any=2, check:Any=(a function))

assert_string

assert_string(actual:Any, title:Any=null)

attrs

attrs(obj:Any)

attrs(obj:Any, v:Any)

aws_regions

aws_regions()

aws_regions(cb:Fun)

Backtrace

Backtrace()

Backtrace constructor

band

band(a:Int, b:Int)

Bitwise and

basename

basename(s:Str)

Get basename of the file. Uses BASENAME(1).

body_missing_in_retry

body_missing_in_retry()

Bool

Bool(x:Any)

Convert to Bool

Bool(al:ArrLike)

Call Bool() on the underlying array.

Bool(hl:HashLike)

Bool(fb:FullBox)

Always true

Bool(eb:EmptyBox)

Always false

Bool(d:ArrDiff)

Whether there is a difference

Bool(d:HashDiff)

Whether there is a difference

Bool(p:Path)

Checks whether the path is accessible using access(2) and F_OK.

Bool(p:Process)

Wait for process to finish and see whether exit code is 0

Bool(my:MatchY)

Bool(my:MatchN)

Bool(i:ConstIter)

Bool(i:RangeIter)

Bool(i:ArrIter)

Check whether there are more array elements to iterate over. true: next() will return next element. false: next() will throw NoNext

Bool(i:HashIter)

Bool(t:Table)

bootstrap

bootstrap()

Main entry point. Executed on NGS boot.

bootstrap_exception_catch_wrapper

bootstrap_exception_catch_wrapper()

bootstrap_find_ngs_dir

bootstrap_find_ngs_dir()

bootstrap_find_ngs_dir()

bor

bor(a:Int, b:Int)

Bitwise or

Box

Box(x:Any)

Convert anything to Box (always FullBox)

Box(n:Null)

Convert null to Box (always EmptyBox)

Box(a:Arr)

Convert array to a Box. Throws InvalidArgument if length of the array is not 0 or 1.

Box(a:Arr, idx:Any)

Convert array value indexed by the given index

Box(h:Hash, k:Any)

Convert hash value indexed by the given key to a Box

bxor

bxor(a:Int, b:Int)

Bitwise xor

c_access

c_access(pathname:Str, mode:Int)

Call ACCESS(2)

c_close

c_close(fd:Int)

c_closedir

c_closedir(dirp:C_DIR)

c_dlopen

c_dlopen(filename:Str, flags:Int)

Unfinished feature. Don't use!

c_dup2

c_dup2(oldfd:Int, newfd:Int)

c_dup2(oldfd:Int, newfd:Int)

c_execve

c_execve(filename:Str, argv:Arr, envp:Arr)

c_exit

c_exit(status:Int)

Call EXIT(3)

c_ffi_call

c_ffi_call(cif:c_ffi_cif, fn:CSym, argv:Arr)

Unfinished feature. Don't use!

c_ffi_prep_cif

c_ffi_prep_cif(rtype:c_ffi_type, atypes:Arr)

Unfinished feature. Don't use!

c_fork

c_fork()

Call FORK(2)

c_fstat

c_fstat(fd:Int)

Call FSTAT(2)

c_getpid

c_getpid()

Call GETPID(2)

c_getppid

c_getppid()

Call GETPPID(2)

c_isatty

c_isatty(fd:Int)

c_kill

c_kill(pid:Int, sig:Int)

c_lseek

c_lseek(fd:Int, offset:Int, whence:Str)

c_lstat

c_lstat(pathname:Str)

Call LSTAT(2)

c_open

c_open(pathname:Str, flags:Str)

c_opendir

c_opendir(name:Str)

c_pcre_compile

c_pcre_compile(regexp:Str, flags:Int)

Throws RegExpCompileFail on errors.

c_pcre_exec

c_pcre_exec(regexp:RegExp, subject:Str, offset:Int, options:Int)

Search string for regular expression. Uses PCRE_EXEC(3). Do not use this function directly!

c_pipe

c_pipe()

Call PIPE(2)

c_poll

c_poll(fds_evs:Arr, timeout:Int)

c_pthread_attr_init

c_pthread_attr_init(attr:c_pthread_attr_t)

c_pthread_attr_t

c_pthread_attr_t()

c_pthread_create

c_pthread_create(attr:c_pthread_attr_t, start_routine:Closure, arg:Any)

Call PTHREAD_CREATE(3). Not recommended for direct calls, use Thread type instead.

c_pthread_join

c_pthread_join(thread:c_pthread_t)

Call PTHREAD_JOIN(3). Not recommended for direct calls, use Thread type instead.

c_pthread_mutex_init

c_pthread_mutex_init(mutex:c_pthread_mutex_t)

c_pthread_mutex_lock

c_pthread_mutex_lock(mutex:c_pthread_mutex_t)

c_pthread_mutex_t

c_pthread_mutex_t()

c_pthread_mutex_unlock

c_pthread_mutex_unlock(mutex:c_pthread_mutex_t)

c_pthread_self

c_pthread_self()

c_read

c_read(fd:Int, count:Int)

c_readdir

c_readdir(dirp:C_DIR)

c_stat

c_stat(pathname:Str)

Call STAT(2)

c_strcasecmp

c_strcasecmp(a:Str, b:Str)

c_strcmp

c_strcmp(a:Str, b:Str)

c_strerror

c_strerror(errnum:Int)

c_waitpid

c_waitpid(pid:Int)

C_WEXITSTATUS

C_WEXITSTATUS(status:Int)

c_write

c_write(fd:Int, s:Str)

C_WTERMSIG

C_WTERMSIG(status:Int)

cached

cached(cb:Fun)

calculate_num_cols_to_show

calculate_num_cols_to_show(t:Table, max_colums_widths:Arr, available_cols:Int)

call

call(r:Return, v:Any=null)

Implements calling of Return type instances like the finish(i) call in the example below

call(hook:Hook, *args:Arr)

Runs all handlers passing all args.

ceil

ceil(r:Real)

Ceil a number

cell_display_width

cell_display_width(x:Any)

Calculate cell display width - any Str()-able instance

cell_display_width(x:Arr)

Calculate cell display width for an array

cell_display_width(x:Arr)

Calculate cell display width for an empty array

child_fd

child_fd(p:Pipe)

Get child process end file descriptor of Pipe. It's the writing end for Pipe(STDLIB_CHILD_TO_PARENT_PIPE_DIR).

child_fd(p:Pipe)

Get child process end file descriptor of Pipe. It's the reading end for Pipe(STDLIB_PARENT_TO_CHILD_PIPE_DIR).

chr

chr(code:Int)

Get character (byte) by it's ordinal value.

close

close(f:File)

Close a file and sets the "fd" field to null. Uses CLOSE(2). Throws InvalidArgument if file is not open. Throws FileIOFail if an underlying error occurs.

close_reading_end

close_reading_end(p:Pipe)

Close reading end of the Pipe

close_writing_end

close_writing_end(p:Pipe)

Close writing end of the Pipe

code

code(a:Arr)

Convert an array to NGS code that would produce the array when executed. Not fully functional yet.

code(h:Hash)

Convert a Hash to NGS code that would produce the given Hash when executed. Not fully functional yet.

code(b:Bool)

code(n:Int)

Convert an Int to NGS code that would produce the integer when executed. Not fully functional yet.

code(s:Str)

Convert a Str to NGS code that would produce the string when executed. Not fully functional yet. BUG: Does not do escaping.

code(n:Null)

Convert null to NGS code that would produce null when executed.

collector

collector(a:Arr, body:Fun)

Defines collector { ... collect(...) ... } behaviour for arrays

collector(h:Hash, body:Fun)

Defines collector { ... collect(...) ... } behaviour for hashes

collector(n:Int, body:Fun)

Defines collector { ... collect(...) ... } behaviour for integers (summarizes collected items).

column

column(t:Table, k:Str)

column(t:Table, n:Int)

columns

columns(t:Table)

compile

compile(code:Str, fname:Str)

Compile NGS source to bytecode.

config

config(k:Str)

Get configuration for the given key. Lookup order / first wins: (1) Environment variable NGS_$k (2) previously set config(k, v)

config(k:Str, v:Any)

Set configuration. To be used with config(k:Str).

converge

converge(rd:ResDef, **props:Hash)

copy

copy(arr:Arr)

count

count(arr:Arr, predicate:Any)

Count number of items that satisfy the predicate. TODO: Make it work on anything with each() method.

count(arr:Arr)

Count all true values.

count(h:Hash, predicate:Any)

Count number of key-value pairs in Hash that satisfy the predicate.

create

create(rd:ResDef, n:Int, **props:Hash)

create(rd:Vpc, **props:Hash)

create(rd:Igw, **props:Hash)

create(rd:SecGroup, **props:Hash)

create(rd:Subnet, **props:Hash)

create(rd:Instance, **props:Hash)

create(rd:Elb, **props:Hash)

create(rd:RecordSet, **props:Hash)

created

created(rd:ResDef, resources:Arr, props:Hash)

debug

debug(s:Str)

Same as debug('default', s)

debug(facility:Str, s:Str)

Debug to standard error. "DEBUG" environment variable must be non-empty string to activate. Otherwise nothing is outputted. TODO: Not output thread ID if there is only one thread. TODO: Timestamps?

decode_json

decode_json(s:Str)

Decode (parse) JSON.

del

del(h:Hash, k:Any)

Delete hash key. No exception is thrown if key is not found, the deletion is just skipped then.

delete

delete(rd:ResDef)

delete(r:VpcRes)

delete(r:IgwRes)

delete(r:SecGroupRes)

delete(r:SubnetRes)

delete(r:InstanceRes)

delete(elb:Elb)

delete(r:RecordSetRes)

dflt

dflt(i:NormalTypeInstance, k:Any, v:Any)

Set an attribute in an instance if it's not already set

dflt(arr:Arr, k:Any, v:Any)

Set an attribute on instances if it's not already set

dflt(hl:HashLike, k:Any, v:Any)

dflt(h:Hash, k:Any, v:Any)

Set an key in a Hash if it's not already set

dflt(fb:FullBox, x:Any)

Do nothing

dflt(eb:EmptyBox, x:Any)

Wrap x in a Box

die

die(s:Str, exit_code:Any=1)

Write message in s to standard error and exit

Diff

Diff(a:Arr, b:Arr, full:Bool=false)

Compare arrays. Warning: Hash is used so internal Hash keys comparison is used, not ==

Diff(a:Arr, b:Arr, full:Bool=false)

Diff(a:Arr, b:Arr, full:Bool=false)

Diff(a:Hash, b:Hash)

Compare hashes

dir

dir(dirname:Str, subtype:Any=false)

List directory contents. Warning: "." and ".." are included. Throws DirFail when directory can not be listed.

dir(dirname:Str, cb:Fun, subtype:Any=false)

List directory contents and call cb with Path() of each found item. Warning: "." and ".." are included.

drop

drop(i:Iter, n:Int)

Fetch and drop next n values from iterator i.

drop_while

drop_while(something:Eachable1, predicate:Any)

EXPERIMENTAL! Do not use!

dump

dump(obj:Any)

Low-level data structure dump. Used for debugging NGS itself.

dup2

dup2(oldfd:Int, newfd:Int)

dup2_reading_end

dup2_reading_end(p:Pipe, newfd:Int)

DUP2(2) reading file descriptor

dup2_writing_end

dup2_writing_end(p:Pipe, newfd:Int)

DUP2(2) writing file descriptor

each

each(al:ArrLike, cb:Fun)

Call cb for each element in the underlying array.

each(hl:HashLike, cb:Fun)

each(r:NumRange, cb:Fun)

Iterates over the elements of r, passing each in turn to cb.

each(arr:Arr, cb:Fun)

Iterates over the elements of arr, passing each in turn to cb along with args: cb(ITEM)

each(arr:Arr, n:Int, cb:Fun)

Process each N elements of an Array at a time. Throws InvalidArgument if number of items in arr is not divisible by n. cb is called as cb(eltI, ..., eltJ) where I is multiple of n and J is I+n-1

each(h:Hash, cb:Fun)

Iterate a Hash.

each(fb:FullBox, cb:Fun)

Call cb with the value of the FullBox

each(eb:EmptyBox, cb:Fun)

Do nothing

each(n:Int, cb:Fun)

Iterate from zero up to but not including n

each(s:Str, cb:Fun)

Iterates over all string characters (currently bytes). TODO: example.

each(rd:ResDef, cb:Fun)

each(i:Iter, cb:Fun)

Calls cb with each element from i

each(t:Table, cb:Fun)

each(t:TextCollector, *args:Arr)

each_idx_key_val

each_idx_key_val(h:Hash, cb:Fun)

Iterate a Hash.

each_idx_val

each_idx_val(arr:Arr, cb:Fun)

Iterates over the elements of arr, passing each in turn to cb along with index and args: cb(INDEX, ITEM)

echo

echo(s:Str)

Print given string and a newline to stdout.

echo(fd:Int, s:Str)

Print given string and a newline to a file referenced by descriptor.

echo(x:Any)

Echo non-string. Converts x to string first, using Str()

echo(t:Table)

Displays a table. Implemented only for tty output (or output_format=text configuration)

echo(t:Table)

Output (echo) CSV table with cells that contain arrays converted to columns. TODO: data escaping.

encode_hex

encode_hex(s:Str)

Encodes each character in a string as two uppercase hexadecimal digits

encode_html

encode_html(s:Str)

Encodes HTML. Escapes &, < and > .

encode_html_attr

encode_html_attr(s:Str)

Encodes HTML attribute. Escapes &, <, >, " and ' .

encode_json

encode_json(obj:Any)

Encode JSON (serialize a data structure to JSON)

encode_uri_component

encode_uri_component(s:Str)

Encodes URI component, escaping with %XX hexadecimal codes.

ends_with

ends_with(haystack:Str, needle:Str)

Check whether a string ends with another string

error

error(s:Str)

Write error message to standard error.

exception_specific_message

exception_specific_message(e:Exception)

Do nothing. Catch-all for exception_specific_message().

exception_specific_message(gnf:GlobalNotFound)

Format GlobalNotFound exception message.

expect

expect(rd:ResDef, e:Int)

expect(rd:ResDef)

fetch

fetch(filename:Str, parse_hints:Hash={})

read() and parse() the given file

fetch(parse_hints:Hash={})

Read standard input and parse() it, passing "source" equals "stdin" hint.

filter

filter(something:Eachable1, predicate:Any)

Filter something to an Arr (array) of values using predicate.

filter(something:Eachable1)

Filter nulls out. DEPRECATED, USE something.without(null) INSTEAD.

filter(hl:HashLike, cb:Fun)

filter(h:Hash, predicate:Any)

Filter hash. Build new hash with kev-value pairs selected by predicate.

filter(fb:FullBox, predicate:Any)

Test FullBox value

filter(eb:EmptyBox, predicate:Any)

Do nothing

filter(ds:DelimStr, predicate:Any)

Get new DelimStr with some elements filtered out

filterk

filterk(h:Hash, predicate:Any)

Filter hash by keys, keeping matched

filterv

filterv(h:Hash, predicate:Any)

Filter hash by values

finally

finally(body:Fun, cleanup:Fun)

TODO: make sure cleanup() is not run twice in case of exception in cleanup() itself

find

find(rd:Vpc)

find(rd:Igw)

find(rd:RouteTable)

find(rd:SecGroup)

find(rd:Subnet)

find(rd:Image)

find(rd:Instance)

find(rd:Elb)

find(rd:RecordSet)

find_in_path

find_in_path(executable_name:Str)

Finds given binary and returns it's full path. Throws ExecutableNotFound if the binary was not found. Search strategy: "/" in the name of the binary means that given executable_name is a path so it's returned as-is (wrapped in Path). If PATH environment variable exists, the given directories are searched. If PATH is not set built-in value for PATH is used to search: /usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin

finished_ok

finished_ok(p:Process)

Decide whether process finished normally: exit code must be 0.

finished_ok(p:Process)

Decide whether /bin/false process finished normally: exit code must be 1.

finished_ok(p:Process)

Decide whether specific process finished normally: exit code must be 0 or 1.

finished_ok(p:Process)

first

first(e:Eachable1, predicate:Any)

Find first element in e that satisfies the predicate.

first(e:Eachable1)

Find first element in e that satisfies Bool(e) == true. Exactly same as first(e, identity).

flatten

flatten(e:Eachable)

Flatten one level.

floor

floor(r:Real)

Floor a number

get

get(arr:Arr, idx:Int, dflt:Any)

get(h:Hash, k:Any, dflt:Any)

Get hash value by key or dflt if it does not exist

get(hl:HashLike, k:Any, dflt:Any)

get(hl:HashLike, k:Any)

get(h:Hash, k:Any)

Get hash value by key or null if it does not exist

get(e:Eachable1, attr:Str)

Return array made of given attribute of each element of given Eachable1 where present

get(e:Eachable1, attr:Str, dflt:Any)

Return array made of given attribute of each element of given Eachable1 where present or default value where the attribute is not present Return array (? depends on map() ?) made of given attribute of each element of given Eachable1

get(fb:FullBox, dflt:Any=null)

Get FullBox value

get(eb:EmptyBox)

Get EmptyBox value. Always throws InvalidArgument.

get(eb:EmptyBox, dflt:Any)

Get EmptyBox value

get_c_errno

get_c_errno()

glob

glob(pattern:Str, start_dir:Any=.)

Work in progress, do not use!

global_not_found_handler

global_not_found_handler(name:Str)

Called when reading undefined global. Implements autoloading. Searches in $NGS_DIR/autoload/NAME.ngs WARNING: May have security implications when looking up a name from untrusted source.

globals

globals()

Get all global variables as Hash

group

group(a:Arr, cb:Fun)

TODO. Group items from a by key returned by cb

has

has(container:Any, element:Any)

Exactly same as "element in container". It's just more convenient in specific cases.

Hash

Hash(obj:NormalTypeInstance)

Get all attributes and their values as key-value pairs in the resulting Hash.

Hash(hl:HashLike)

Get the underlying Hash with all the keys/values of the HashLike. Note: the returned value is not a copy.

Hash(arr:Arr)

Create a Hash from Arr of Arr[2]

Hash(arr:Arr, attr:Str)

TODO. Not sure it's used anywhere. Maybe remove?

Hash(arr:Arr, cb:Fun)

Create a Hash from keys in arr using cb for values calculation

Hash(keys:Arr, values:Arr)

Create a Hash from keys in "keys" and corresponding values in "values"

Hash(arr:Arr, key_attr:Str, val_attr:Str)

Create Hash from Arr of something that has key and value attribute

hash

hash(x:Any)

Calculate hash value. Same function that Hash uses internally. Currently Fowler-Noll-Vo (FNV) hash function.

id

id(thread:c_pthread_t)

id(r:VpcRes)

id(r:IgwRes)

id(r:RouteTableRes)

id(r:SecGroupRes)

id(r:SubnetRes)

id(r:ImageRes)

id(r:InstanceRes)

id(instance:InstanceRes)

id(r:ElbRes)

identity

identity(x:Any)

ids

ids(rd:ResDef)

in

in(symbol:Str, lib:CLib)

Unfinished feature. Don't use!

in(attr:Str, obj:NormalTypeInstance)

Check whether NormalType (a type that is typically defined by user) instance has an attribute.

in(x:Any, h:Hash)

Check key presence in a Hash

in(name:Str, hl:HashLike)

in(x:Any, arr:Arr)

Checks whether element x is in array arr

in(needle:Str, haystack:Str)

Determin if needle substring occurs at least once in haystack

index

index(arr:Arr, predicate:Any)

Find index of first value that satisfies the predicate. TODO: Make it work on anything with each() method.

indexes

indexes(arr:Arr, predicate:Any)

Find all indexes of values that satisfy the predicate TODO: Make it work on anything with each() method

inherit

inherit(t:Type, parent:Type)

Make t inherit from parent. Do not use directly. Use "type MyType(parent)".

init

init(e:Exception, message:Str)

init(e:Exception, cause:Exception)

init(h:Hash)

Trivial initialization helper for init(o, ...) Sets object fields from the supplied parameters

init(e:IndexNotFound, message:Str, container:Any, key:Any)

IndexNotFound exception constructor

init(e:InstantiatingAbstractType, t:Type)

init(al:ArrLike, attr:Str=items)

ArrLike constructor

init(hl:HashLike, h:Hash=null)

init(hook:Hook)

Hook constructor.

init(e:CException, message:Str)

CException constructor. In addition to storing message attribute, adds errno and errno_name attributes.

init(r:Range, start:Any, end:Any, include_start:Any=true, include_end:Any=false, step:Any=1)

Range constructor

init(b:FullBox, *args:Arr)

Do not use directly! Helper constructor that throws InvalidArgument when FullBox is created with zero or more than one argument.

init(b:FullBox, val:Any)

FullBox constructor. Saves val into .val

init(p:Path, s:Str)

Path constructor

init(p:Path, other:Path)

Path constructor. Duplicates other Path.

init(pipe:Pipe)

Pipe constructor. Create UNIX pipe using PIPE(2). Throws PipeCreateFail if pipe can not be created.

init(pipe:Pipe, direction:Int)

Pipe constructor. Create UNIX pipe using PIPE(2). Throws PipeCreateFail if pipe can not be created.

init(f:File, path:Str)

init(f:File, fd:Int)

init(p:Process, c:Command)

Process constructor

init(my:MatchY, matches:Arr)

Successful match constructor

init(mf:MatchFail, msg:Str, container:Any, pattern:Any)

init(s:SubSeq, val:Any)

SubSec construcor

init(rd:ResDef, anchor:Any)

init(rd:ResDef)

init(r:Res, def:ResDef, props:Hash)

init(tf:TestFail, message:Str)

init(rd:ResDef, **kw:Hash)

init(rd:ResDef, _ngs_name:Str)

init(rd:ResDef, _ngs_tags:Hash)

init(rd:SecGroup, anchor:Arr)

init(rd:SecGroup, name:Str, VpcId:Any)

init(rd:Instance, **kwargs:Hash)

init(ds:DelimStr, s:Str, delim:Str=:)

DelimStr constructor

init(ds:DelimStr, a:Arr, delim:Str=:)

DelimStr constructor

init(i:ConstIter, val:Any)

Constant iterator constructor.

init(i:RangeIter, r:NumRange)

init(i:ArrIter, arr:Arr)

ArrIter constructor.

init(i:HashIter, h:Hash)

EXPERIMENTAL! Do not use!

init(kv:KV, k:Any, v:Any)

init(e:LockFail, op:Str, code:Int, msg:Str)

init(l:Lock)

init(s:Stats, a:Arr)

Makes Stats, with each element in the array counted as if push()ed

init(t:Table, name:Any=null)

Initialize rows to an empty array

init(t:Table, name:Any, rows_hashes:Arr)

Create named table containing provided rows

init(t:Table, rows_hashes:Arr)

init(t:Thread, f:Fun, arg:Any)

init(t:Thread, f:Fun)

init(t:TextCollector, pfx:Any=, pfx_inc:Any= , heading_level:Any=1)

init(dn:DocNode, children:Arr=null)

init(tdn:TextDocNode, text:Arr)

init(tdn:TextDocNode, text:Str)

inspect

inspect(val:Any)

Inspect any value.

inspect(r:Real)

Inspect Real

inspect(i:Int)

Inspect Int

inspect(s:Str)

Inspect Str

inspect(a:Arr)

Inspect Arr

inspect(h:Hash)

Inspect Hash

inspect(p:Process)

Inspect Process

Int

Int(r:Real)

Convert Real (floating) number to Int. Floating part is truncated.

Int(s:Str, base:Int)

Convert Str to Int.

Int(s:Str)

Convert base-10 string to Int. Throws InvalidArgument if the number in s is not well-formatted.

Int(b:Bool)

Convert Bool to int.

ip

ip(c:Closure)

Get closure code instruction pointer.

is

is(obj:Any, t:Type)

Check whether obj is of type t. Uses same function that is used for matching arguments with method parameters when calling a method.

is not

is not(a:Any, b:Any)

"is not" operator. Exactly same as "not(a is b)".

is_global_variable_defined

is_global_variable_defined(idx:Int)

Do not use directly! Check whether global variable is defined by index.

isatty

isatty(fd:Int)

Check whether given fd represents a TTY. Uses ISATTY(3). Throws TtyCheckFail.

Iter

Iter(i:Iter)

Supports "for i in existing_iterator"

Iter(r:NumRange)

Iter(arr:Arr)

Calls ArrIter constructor.

Iter(h:Hash)

join

join(arr:Arr, s:Str)

join(a:Arr, sep:Arr)

EXPERIMENTAL! Do not use!

join(a:Arr, s:Str)

Join non-strings. Converts a elements to string first, then uses built-in join().

join(threads:Arr)

join(t:Thread)

keys

keys(h:Hash)

Get Hash keys as an array

keys(hl:HashLike)

kill

kill(pid:Int, sig:Int=15)

Send signal to a process. Uses KILL(2). Throws KillFail on error.

kill(p:Process, sig:Int=15)

Send signal to a Process. Uses KILL(2). Throws InvalidArgument if Process does not have "pid". Throws KillFail on error.

latest

latest(rd:Image)

len

len(arr:Arr)

len(s:Str)

Get Str length in bytes

len(h:Hash)

Get number of key-value pairs in a Hash

len(al:ArrLike)

Get length of the underlying array.

len(hl:HashLike)

len(rd:ResDef)

len(t:Table)

limit

limit(a:Arr, l:Int)

Truncate an array if necessary so it would have maximum l elements.

limit(h:Hash, l:Int)

Truncate a Hash if necessary so it would have maximum l key-value pairs.

limit(s:Str, n:Int, marker:Str=)

Truncate a string if necessary so it would have maximum n characters (currently bytes).

lines

lines(s:Str)

Split s to strings using end-of-line separators. UNIX and Windows line endings supported (Windows - not tested yet). Warning: Max OS <= 9 line separation of CR (\r) is not supported

lines(s:Str, cb:Fun)

Split s to strings using end-of-line separators and call cb for each one of the lines. TODO: More efficient implementation, which would not have temporary array of all lines.

lines(f:File, cb:Fun)

Iterate over lines of the file

lines(f:File)

lines(f:File, lines_:Arr)

lines(p:Process)

Wait for the process and return lines of its stdout.

lines(p:Process, cb:Fun)

Iterate lines of Process' stdout, calling cb with successive lines. Warning: current implementation waits for the process to finish and accumulates all its stdout.

load

load(bytecode:Str, func_name:Str)

Load compiled bytecode.

log

log(s:Str)

Log to standard output. Later log output will be treated specially by the shell. It will have suitable representation in the UI. Use log() when it's semantically a log.

log(rd:ResDef, method:Str, s:Str)

log(r:Res, method:Str, s:Str)

log_test_ok

log_test_ok(s:Str)

lstat

lstat(pathname:Str)

Issue lstat() system call. Throws StatFail if the call fails.

lstat(p:Path)

Issue lstat() system call. Throws StatFail if the call fails.

lte

lte(a:Str, b:Str)

Case-insensitive LessThan or Equal comparison for strings

map

map(something:Eachable, mapper:Fun)

Map something to an Arr (array) of values using mapper.

map(arr:Arr, n:Int, mapper:Fun)

Map each N elements of an Array at a time. mapper is called as cb(eltI, ..., eltJ) where I is multiple of n and J is I+n-1 Throws InvalidArgument if number of items in arr is not divisible by n. mapper is called as mapper(eltI, ..., eltJ) where I is multiple of n and J is I+n-1

map(h:Hash, mapper:Fun)

Map a Hash

map(fb:FullBox, mapper:Fun)

Map FullBox value

map(eb:EmptyBox, mapper:Fun)

Do nothing

map_base_idx

map_base_idx(base:Any, n:Int, mapper:Fun)

EXPERIMENTAL! Map when there is more than one element. If there is exactly one element, it's left as is

map_idx_val

map_idx_val(arr:Arr, mapper:Fun)

Map an Arr to an Arr (array) of values using mapper mapper is called as mapper(INDEX, ITEM)

mapk

mapk(h:Hash, mapper:Fun)

Map Hash keys. Build new Hash with same values as in h but keys mapped by mapper.

mapkv

mapkv(h:Hash, mapper:Fun)

Map Hash keys and values. Build new Hash with keys and values mapped by mapper.

mapv

mapv(h:Hash, mapper:Fun)

Map Hash values. Build new Hash with same keys as in h but values mapped by mapper.

match

match(a:Any, b:Any)

Used by match EXPR { ... } construct.

max

max(arr:Arr)

TODO

max(arr:Arr, cb:Fun)

TODO

merge_sorted

merge_sorted(a:Arr, b:Arr, lte:Fun)

Merge sorted arrays.

min

min(arr:Arr)

TODO

min(arr:Arr, cb:Fun)

TODO

n

n(h:Hash)

Convert hash values to integers where possible

next

next(i:ConstIter)

Return the constant iterator value

next(i:RangeIter)

next(i:ArrIter)

Get value of the next element of the array iterated over.

next(i:HashIter)

none

none(e:Eachable1, predicate:Fun)

Check that there is no element in e that satisfies the given predicate. Exactly same as not(any(e, predicate)) .

none(b:Box, predicate:Any)

Test Box value

nop

nop()

Do nothing

normalize_presence_list

normalize_presence_list(x:Any)

not

not(x:Bool)

Invert boolean

not(x:Any)

Boolean negation for non-boolean values. Converts to boolean first.

not in

not in(a:Any, b:Any)

"not in" operator. Exactly same as "not(a in b)"

nuke_null

nuke_null(a:Arr)

Used for command line arguments such as ['--vpc-id', my_vpc_id()].nuke_null() If my_vpc_id() is null the whole array is not needed

only

only(predicate:Any, mapper:Fun)

Transform mapper to handle only items matching predicate. Non-matching items will be returned as is.

open

open(f:File, flags:Str)

Open a file and set the "fd" field to the file descriptor. Uses OPEN(2). Throws InvalidArgument if file is already open. Throws FileIOFail if an underlying error occurs.

opt_prop

opt_prop(rd:ResDef, name:Str, props:Hash)

Get optional resource property, looking up in properties first and then in anchor

opt_prop(rd:ResDef, name:Str, props:Hash, cb:Fun)

Run cb with optional resource property if it exists, uses opt_prop(ResDef, Str, Hash)

ord

ord(s:Str, idx:Int)

Get character (byte) ordinal value. Throws InvalidArgument if idx is not pointing into s.

ord(s:Str)

Get character (currently byte) code. Throws InvalidArgument if s is not of length 1.

params

params(m:NativeMethod)

params(c:Closure)

Get closure parameters.

parent_fd

parent_fd(p:Pipe)

Get parent process end file descriptor of Pipe. It's the reading end for Pipe(STDLIB_CHILD_TO_PARENT_PIPE_DIR).

parent_fd(p:Pipe)

Get parent process end file descriptor of Pipe. It's the writing end for Pipe(STDLIB_PARENT_TO_CHILD_PIPE_DIR).

parse

parse(s:Str)

Call parse(s, {})

parse(s:Str, hints:Hash)

Attempt to parse JSON. Uses decode_json().

parse(s:Str, hints:Hash)

EXPERIMENTAL. KVS (key-value separator) hint for parse()

parse(s:Str, hints:Hash)

EXPERIMENTAL. FS (field separator) hint for parse()

parse(s:Str, hints:Hash)

Handle fields_names hint - run parse() and make Arr[Hash] from Arr[Arr] using provided fields_names

parse(s:Str, hints:Hash)

Parse the output of "aws" command. Extracts the array (see "s" below"). For "describe-instances", flattens the instance list.

parse(s:Str, hints:Hash)

Parse the output of "find" command which does not use "-printf". Handles "-print0".

partial

partial(f:Fun, *bind_args:Arr)

Returns partially-applied function

partial_tail

partial_tail(f:Fun, *bind_args:Arr)

Same as partial() but the bound arguments are last ones

Path

Path(s:Str, subtype:Any=false)

Path constructor

peek

peek(i:ConstIter)

Return the constant iterator value

peek(i:ArrIter)

Preview value of the next element of the array iterated over. Does not affect internal pointer which means it does not affect of value returned by next().

peek(i:HashIter)

Pfx

Pfx(val:Any)

Convenience method for creating MustPfx

pid

pid()

Get process ID

pmap

pmap(a:Arr, mapper:Fun)

pmap(n:Int, mapper:Fun)

pop

pop(arr:Arr)

Pop item from an array. Removes last item in array and returns it. Throws EmptyArrayFail.

pos

pos(haystack:Str, needle:Str, start:Int)

Find substring position

pos(haystack:Str, needle:Str)

Find substring in a string.

ppid

ppid()

Get parent process ID

Pred

Pred(anything:Any)

Convert anything to a predicate.

Pred(f:Fun)

Convert a function to predicate.

Pred(t:Type)

Convert a type to a predicate.

Pred(s:SubSeq)

Pred(r:RegExp)

Convert regular expression to a predicate.

print_exception

print_exception(e:Exception, level:Int=0, parent:Exception=null)

Print exception to stderr. Uses inspect().

ptimes

ptimes(n:Int, cb:Fun)

push

push(arr:Arr, v:Any)

Append item to an array.

push(al:ArrLike, val:Any)

Push an element to the underlying array.

push(hook:Hook, handler:Closure)

Add unnamed handler. The hook is automatically named "pushed-N" where N is sequential integer.

push(s:Stats, k:Any)

Increment the named counter

push(t:Table, row_arr:Arr)

push(t:Table, row_hash:Hash)

push(t:TextCollector, s:Str)

push(dn:DocNode, child:DocNode)

rand

rand()

Get random number between 0 and RAND_MAX-1. Uses RANDOM(3).

rand(something:Any, n:Int)

Pick n elements from something. Uniqueness of picked elements is not guaranteed.

rand(n:Int)

Pick random number from 0 up to but not including n

rand(a:Arr)

Pick one random element from array

rand(a:Str)

Pick random character from a string

rand(a:Str, n:Int)

rand(r:NumRange)

Pick one random element from a range

rand_uniq

rand_uniq(something:Any, n:Int)

Pick n random unique elements from something

read

read(fname:Str)

Fetches the whole file

read(fd:Int)

Read all data from a file referenced by file descriptor without parsing it.

read()

Read all data from a file referenced by file descriptor 0 (stdin) without parsing it. Same as read(0)

read(p:Pipe)

Read from Pipe without parsing. TODO: document if it throws.

Real

Real(n:Int)

Convert Int to Real

Real(s:Str)

Convert a string to real (floating) number, inefficiently

reduce

reduce(something:Eachable1, start:Any, f:Fun)

Combine items to a single value using the supplied binary function First f is applied to start and the first element of something then on each step f is applied to previous result and next element of something.

register_column

register_column(t:Table, k:Any)

reject

reject(something:Eachable, predicate:Any)

Filter something to an Arr (array) of values using predicate

rejectk

rejectk(h:Hash, predicate:Any)

Filter hash by keys, removing matched

rejectv

rejectv(h:Hash, predicate:Any)

Filter hash by values

release

release(l:Lock)

replace

replace(dst:Any, src:Any)

DISCOURAGED. Replace one object with another. dst and src must be of the same type.

replace(something:Eachable1, src:Any, dst:Any)

Replace all occurrences of src with dst

replace(s:Str, r:RegExp, mapper:Fun)

Replace all occurrences of r

req_prop

req_prop(rd:ResDef, name:Str, props:Hash)

Get resource property, looking up in properties first and then in anchor

require

require(fname:Str)

Runs the given file

resolve_global_variable

resolve_global_variable(name:Str)

Do not use directly! Get global variable index by name.

resolve_instruction_pointer

resolve_instruction_pointer(ip:Int)

Resolves Instruction Pointer to source location

retry

retry(times:Int=60, sleep:Any=1, logger:Fun=(a function), success_predicate:Any=(a function), catch_exceptions:Bool=true, title:Any=<retry>, progress_cb:Fun=(a function), success_cb:Fun=(a function), fail_cb:Any=null, body:Fun=(a function))

Retry. Executes given "body" "times" times. Throws RetryFail if all calls fail and fail_cb is not provided.

Return

Return()

Get closure-specific Return type. Throwing it, will return from the closure

reverse

reverse(arr:Arr)

Make new array which is a reversed given array

round

round(r:Real)

Round a number

run

run(r:Res, log_pfx:Str, cmd:Command)

run(rd:ResDef, log_pfx:Str, cmd:Command)

SafeStr

SafeStr(val:Any)

Don't use, subject to change, including name

set

set(obj:Any, attr:Str, val:Any)

Sets the given attribute to the given value

set_global_variable

set_global_variable(idx:Int, val:Any)

Do not use directly! Set global variable by index.

Sfx

Sfx(val:Any)

Convenience method for creating MustSfx

shift

shift(arr:Arr)

shift(arr:Arr, dflt:Any)

shift(h:Hash, k:Any)

Get the given key from a Hash and remove it from the Hash. Underlying h[k] may throw KeyNotFound.

shift(h:Hash, k:Any, dflt:Any)

Get a key from a Hash and remove it from the Hash. If they key is not in the Hash, return dflt

sort

sort(a:Arr, lte:Fun=(a function))

Sort an array.

sort(a:Arr, attr:Str, lte:Fun=(a function))

Sort an array based on attribute value

sort(h:Hash, lte:Fun=(a function))

Sort a Hash.

sortk

sortk(h:Hash, lte:Fun=(a function))

Sort Hash by keys

specific

specific(p:Path)

EXPERIMENTAL, do not use outside of stdlib! Instanciates Path sub-type, depending on what p is

split

split(a:Arr, delim:Any)

TODO. Is it used even?

split(s:Str, delim:Str)

Split string by substring

split(s:Str, r:RegExp)

%EX "x10ab20c30y".split(/[0-9]+/).join(" :: ") # "x :: ab :: c :: y"

srand

srand(seed:Int)

Seed random generator. Uses SRANDOM(3).

starts_with

starts_with(haystack:Str, needle:Str)

Check whether a string starts with another string

stat

stat(pathname:Str)

Issue stat() system call. Throws StatFail if the call fails.

stat(p:Path)

Issue stat() system call. Throws StatFail if the call fails.

status

status(s:Str)

Send status to standard error. Later status output will be treated specially by the shell. It will have suitable representation in the UI. Use status() when it's semantically a status - a task that's being done.

stdlib_aws_straighten_tags

stdlib_aws_straighten_tags(a:Arr)

Convert "Tags" array in each element of AWS resources (typically returned by AWS CLI) into Hash. Makes "Tags" much more usable.

stdlib_aws_straighten_tags(h:Hash)

Convert "Tags" array in the given AWS resource (typically returned by AWS CLI) into Hash.

stdlib_aws_straighten_tags(s:Str)

A no-op

stdlib_aws_tags

stdlib_aws_tags(h:Hash)

Str

Str(regexp:RegExp)

Represents RegExp

Str(r:Real)

Convert Real to Str

Str(n:Int)

Convert Int to Str

Str(c:NativeMethod)

String representation of native method.

Str(c:Closure)

String representation of a closure

Str(t:Type)

String representation of a type

Str(i:NormalTypeInstance)

String representation of normal type instance i Normal type is a user defined type. In addition some types defined by NGS are also normal types.

Str(r:Range)

Convert range to human readable representation

Str(s:Str)

No-op constructor

Str(n:Null)

Convert Null to string

Str(b:Bool)

Str(a:Arr)

Convert Arr to string

Str(h:Hash)

Convert Hash to string

Str(x:Any, target_width:Int)

Convert anything to Str of a given width

Str(s:Str, target_width:Int)

Pad a string to given width with spaces

Str(n:Int, target_width:Int)

Convert a number to a string and pad it

Str(p:Path)

String representation of a Path (or it's sub-type)

Str(p:Pipe)

Str(f:File)

String representation of File

Str(r:Redir)

TODO

Str(p:Process)

Wait for the process to finish and return its standard output.

Str(s:SubSeq)

Str(rd:ResDef)

Str(r:Res)

Str(r:Vpc)

Str(ds:DelimStr)

Str(i:ArrIter)

Textual representation of ArrIter.

Str(i:HashIter)

Str(kv:KV)

Str(t:TextCollector)

StrForTable

StrForTable(x:Any)

StrForTable(x:Any, width:Int)

StrForTable(x:Null)

StrForTable(x:Null, width:Int)

StrParams

StrParams(f:Fun)

TODO: Defaut values

Strs

Strs(h:Hash)

Build array of Str where each resulting string is of the form "KEY=VALUE"

subset

subset(smaller:Arr, larger:Arr)

subset(smaller:Hash, larger:Hash)

subset(smaller:IpPermBox, larger:IpPermBox)

sum

sum(something:Any)

Calculate sum of the elements

take

take(i:Iter, n:Int)

Fetch and convert to array next n values from iterator i.

take_while

take_while(something:Eachable1, predicate:Any)

EXPERIMENTAL! Do not use!

tap

tap(val:Any, cb:Fun)

Call cb with val

test

test(name:Str, f:Fun)

the_one

the_one(something:Eachable1, predicate:Any)

Find the only element that satisfies the predicate. Throws TheOneFail exception if there are no elements that satisfy the predicate or if there is more than one element that satisfies the predicate.

the_one(something:Eachable1, predicate:Any, body:Fun, found_more:Fun=(a function), found_none:Fun=(a function))

Find the only element that satisfies the predicate and execute given code with the value

the_one(something:Eachable1)

Extract the only element. Throws TheOneFail exception if there are no elements or if there is more than one element.

throw_if_no_next

throw_if_no_next(i:Iter)

Private method of Iter.ngs, will be hidden in future.

time

time()

Get time as the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). Wraps TIME(2).

times

times(n:Int, cb:Fun)

Call cb n times without arguments.

to_exit_code

to_exit_code(x:Any)

to_exit_code(b:Bool)

to_exit_code(n:Int)

to_exit_code(e:Exception)

to_exit_code(b:Box)

Zero for FullBox and one for EmptyBox

to_exit_code(p:Process)

Convert Process to exit code. Waites for the process to finish and uses its exit code.

to_exit_code(m:Match)

Convert Match to exit code.

trunc

trunc(r:Real)

Truncate a number

Type

Type(name:Str, doc:Any)

Create a new type. Do not use directly. Use "type MyType".

Type(t:Str, doc:Any, parent:Type)

Type constructor

Type(t:Str, doc:Any, parents:Arr)

Type constructor

typeof

typeof(x:Any)

Returns type of the given instance

uniq

uniq(arr:Arr)

Return unique values. Warning: uses Hash so comparison is not using == but a built-in hash keys comparison.

unparse

unparse(data:Any, hints:Hash)

Not implemented yet

unshift

unshift(arr:Arr, elt:Any)

Prepend one element to the given array

update

update(dst:Hash, src:Hash)

Update a Hash with key-value pairs from another Hash. For non destructive version use "dst + src".

update(r:VpcRes, props:Hash)

update(r:IgwRes, props:Hash)

update(r:RouteTableRes, props:Hash)

update(sg:SecGroupRes, props:Hash)

update(r:SubnetRes, props:Hash)

update(r:InstanceRes, props:Hash)

update(elb:ElbRes, props:Hash)

update(rrset:RecordSetRes, props:Hash)

users_ids

users_ids(r:SecGroup)

values

values(h:Hash)

Get Hash values as an array

values(hl:HashLike)

wait

wait(p:Process)

Wait for the process to finish. Waits for reading and writing threads to finish first.

warn

warn(s:Str)

Write error message to standard error.

width

width(t:Table)

without

without(arr:Arr, without_elt:Any)

Filter out all occurrences of specific value

without(e:Eachable2, without_k:Any)

Filter out specific key

without(e:Eachable2, without_k:Any, without_v:Any)

Filter out specific key-value pair

without(s:Str, r:RegExp)

Get string with all occurrences of r removed

without(ds:ArrLike, without_elt:Any)

Get new DelimStr without the given element

write

write(s:Str, fd:Int)

Write data to a file referenced by file descriptor. WARNING: Incomplete implementation. TODO: handle errors, throw exceptions. TODO: handle possible EINTR.

write(s:Str, p:Pipe)

Write to Pipe. TODO: document if it throws.

write(s:Str, fname:Str)

zip

zip(*args:Arr)

Make new array which aggregates elements from each of the args arrays n-th element of the new array is an array that contains n-th element of each of the given arrays If some of the arrays in args are shorter than others, they will be logically padded with null

~

~(something:Any, t:Type)

Match a type. Same as "something is t".

~(a:Str, b:Str)

EXPERIMENTAL. For use with AWS Anchors.

~(s:Str, pfx:Pfx)

Check whether s starts with pfx.

~(s:Str, sfx:Sfx)

Check whether s ends with pfx.

~(s:Str, r:RegExp, offset:Int=0, options:Int=0)

Find PCRE regular expression in s. Empty string without options returns MatchN. Throws Error if more than 20 captures are used or if there is an error during matching.

~(argv:Arr, c:Closure)

Tries to match command line arguments with closure parameters.

~~

~~(s:Str, r:RegExp, collect_unmatched:Bool=false)

Find all non-overlapping matches of regular expression in a string.