Types

Any

Any type is parent type of all types. All instances in NGS are of type Any. F(x) ... is same as F(x:Any) ...

Methods

!=(a:Any, b:Any)
Inequality operator
!==(a:Any, b:Any)
Non-sameness operator
%(x:Any, cb:Fun)
Each operator. Same as calling x.each(cb)
+?(a:Any, b:Any)
.(hl:HashLike, k:Any)
..(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"
/(x:Any, mapper:Fun)
Map operator. Same as calling x.map(mapper)
::(nti:NormalTypeInstance, k:Any)
::(h:Hash, k:Any)
::=(nti:NormalTypeInstance, k:Any, v:Any)
::=(h:Hash, k:Any, v:Any)
==(a:Any, b:Any)
==(a:Null, b:Any)
Comparison to null
==(a:Any, b:Null)
Comparison to null
===(a:Any, b:Any)
Sameness comparison.
?(x:Any, predicate:Fun)
Filter operator. Same as calling x.filter(predicate)
[](h:Hash, k:Any)
Get hash value by key. Throws KeyNotFound.
[](hl:HashLike, k:Any)
[]=(arr:Arr, idx:Int, v:Any)
[]=(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)
all(e:Eachable, predicate:Any)
Check whether all elements in arr satisfy the given predicate.
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
ArgvMatcher(option:Str, value:Any, f:Closure)
Sets ARGV matching option.
assert(condition:Any, *args:Arr)
assert_array(actual:Any, title:Any=null)
assert_base(actual:Any, expected:Any, comparison:Any, display_comparison:Any, title:Any, ok_prefix:Any=)
assert_eq(actual:Any, expected:Any, title:Any)
assert_exit_code(p:Process, expected:Int, title:Any=null)
assert_has(actual:Any, expected:Any, title:Any=null)
assert_hash(actual:Any, title:Any=null)
assert_hash_keys(actual:Any, expected:Arr, title:Any=null)
assert_hash_keys_values(actual:Any, expected:Hash, title:Any=null)
assert_min_len(actual:Any, expected:Any, title:Any=null)
assert_output_has(p:Process, expected:Any, title:Any=null)
assert_path_exists(p:Any, title:Any=Path exists)
assert_resolvable(h:Str, title:Any=Resolve host, times:Any=45, sleep:Any=2, check:Any=(a function))
assert_string(actual:Any, title:Any=null)
attrs(obj:Any)
attrs(obj:Any, v:Any)
Bool(x:Any)
Convert to Bool
Box(x:Any)
Convert anything to Box (always FullBox)
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
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.
call(r:Return, v:Any=null)
Implements calling of Return type instances like the finish(i) call in the example below
cell_display_width(x:Any)
Calculate cell display width - any Str()-able instance
config(k:Str, v:Any)
Set configuration. To be used with config(k:Str).
count(arr:Arr, predicate:Any)
Count number of items that satisfy the predicate. TODO: Make it work on anything with each() method.
count(h:Hash, predicate:Any)
Count number of key-value pairs in Hash that satisfy the predicate.
del(h:Hash, k:Any)
Delete hash key. No exception is thrown if key is not found, the deletion is just skipped then.
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(s:Str, exit_code:Any=1)
Write message in s to standard error and exit
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_while(something:Eachable1, predicate:Any)
EXPERIMENTAL! Do not use!
dump(obj:Any)
Low-level data structure dump. Used for debugging NGS itself.
echo(x:Any)
Echo non-string. Converts x to string first, using Str()
encode_json(obj:Any)
Encode JSON (serialize a data structure to JSON)
filter(something:Eachable1, predicate:Any)
Filter something to an Arr (array) of values using predicate.
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(h:Hash, predicate:Any)
Filter hash by keys, keeping matched
filterv(h:Hash, predicate:Any)
Filter hash by values
first(e:Eachable1, predicate:Any)
Find first element in e that satisfies the predicate.
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, 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, dflt:Any)
Get EmptyBox value
glob(pattern:Str, start_dir:Any=.)
Work in progress, do not use!
has(container:Any, element:Any)
Exactly same as "element in container". It's just more convenient in specific cases.
hash(x:Any)
Calculate hash value. Same function that Hash uses internally. Currently Fowler-Noll-Vo (FNV) hash function.
identity(x:Any)
in(x:Any, h:Hash)
Check key presence in a Hash
in(x:Any, arr:Arr)
Checks whether element x is in array arr
index(arr:Arr, predicate:Any)
Find index of first value that satisfies the predicate. TODO: Make it work on anything with each() method.
indexes(arr:Arr, predicate:Any)
Find all indexes of values that satisfy the predicate TODO: Make it work on anything with each() method
init(e:IndexNotFound, message:Str, container:Any, key:Any)
IndexNotFound exception constructor
init(r:Range, start:Any, end:Any, include_start:Any=true, include_end:Any=false, step:Any=1)
Range constructor
init(b:FullBox, val:Any)
FullBox constructor. Saves val into .val
init(mf:MatchFail, msg:Str, container:Any, pattern:Any)
init(s:SubSeq, val:Any)
SubSec construcor
init(rd:ResDef, anchor:Any)
init(rd:SecGroup, name:Str, VpcId:Any)
init(i:ConstIter, val:Any)
Constant iterator constructor.
init(kv:KV, k:Any, v:Any)
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:Thread, f:Fun, arg:Any)
init(t:TextCollector, pfx:Any=, pfx_inc:Any= , heading_level:Any=1)
inspect(val:Any)
Inspect any value.
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(a:Any, b:Any)
"is not" operator. Exactly same as "not(a is b)".
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
match(a:Any, b:Any)
Used by match EXPR { ... } construct.
none(b:Box, predicate:Any)
Test Box value
normalize_presence_list(x:Any)
not(x:Any)
Boolean negation for non-boolean values. Converts to boolean first.
not in(a:Any, b:Any)
"not in" operator. Exactly same as "not(a in b)"
only(predicate:Any, mapper:Fun)
Transform mapper to handle only items matching predicate. Non-matching items will be returned as is.
Path(s:Str, subtype:Any=false)
Path constructor
Pfx(val:Any)
Convenience method for creating MustPfx
Pred(anything:Any)
Convert anything to a predicate.
push(arr:Arr, v:Any)
Append item to an array.
push(al:ArrLike, val:Any)
Push an element to the underlying array.
push(s:Stats, k:Any)
Increment the named counter
rand(something:Any, n:Int)
Pick n elements from something. Uniqueness of picked elements is not guaranteed.
rand_uniq(something:Any, n:Int)
Pick n random unique elements from something
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(t:Table, k:Any)
reject(something:Eachable, predicate:Any)
Filter something to an Arr (array) of values using predicate
rejectk(h:Hash, predicate:Any)
Filter hash by keys, removing matched
rejectv(h:Hash, predicate:Any)
Filter hash by values
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
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.
SafeStr(val:Any)
Don't use, subject to change, including name
set(obj:Any, attr:Str, val:Any)
Sets the given attribute to the given value
set_global_variable(idx:Int, val:Any)
Do not use directly! Set global variable by index.
Sfx(val:Any)
Convenience method for creating MustSfx
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
split(a:Arr, delim:Any)
TODO. Is it used even?
Str(x:Any, target_width:Int)
Convert anything to Str of a given width
StrForTable(x:Any)
StrForTable(x:Any, width:Int)
sum(something:Any)
Calculate sum of the elements
take_while(something:Eachable1, predicate:Any)
EXPERIMENTAL! Do not use!
tap(val:Any, cb:Fun)
Call cb with val
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
to_exit_code(x:Any)
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(x:Any)
Returns type of the given instance
unparse(data:Any, hints:Hash)
Not implemented yet
unshift(arr:Arr, elt:Any)
Prepend one element to the given array
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(ds:ArrLike, without_elt:Any)
Get new DelimStr without the given element
~(something:Any, t:Type)
Match a type. Same as "something is t".