init multimethod

Methods

init(x:Any) Source: stdlib.ngs:7
No op.

Returns

null
init(e:Exception, message:Str) Source: stdlib.ngs:98
Initialize an Exception.

Parameters

messageGoes into .message

Returns

Exception with .backtrace and .message
init(e:Exception, cause:Exception) Source: stdlib.ngs:104
Initialize an Exception.

Returns

Exception with .backtrace and .cause
init(e:Exception, message:Str, cause:Exception) Source: stdlib.ngs:110
Initialize an Exception.

Returns

Exception with .backtrace, .message, and .cause
init(nei:NoEmptyInit) Source: stdlib.ngs:132
EXPERIMENTAL! Do not use! Throws InvalidArgument
init(b:Block) Source: stdlib.ngs:175
Undocumented

Automatically called by NGS for syntax

block NAME BODY
init(rfb:ReturnFromBlock, block:Any, val:Any)internal Source: stdlib.ngs:182
Undocumented
init(h:Hash) Source: stdlib.ngs:261
Trivial initialization helper for init(o, ...) Sets object fields from the supplied parameters

Example

# sets t.a and t.b
F init(t:MyType, a, b) init(args())
init(e:IndexNotFound, message:Str, container:Any, key:Any) Source: stdlib.ngs:294
IndexNotFound exception constructor

Returns

IndexNotFound object with the given message, container and key fields
init(e:InstantiatingAbstractType, t:Type) Source: stdlib.ngs:344
Initializes InstantiatingAbstractType.
init(s:Success, v:Any=null) Source: stdlib.ngs:886
Initialize Success with the given value.
init(f:Failure, e:Exception) Source: stdlib.ngs:889
Initialize Failure with the given value.
init(l:Lit) Source: stdlib.ngs:980
Undocumented
init(l:Lit, val:Any) Source: stdlib.ngs:981
Undocumented
init(ms:MatchSuccess, matches:Arr, pattern:Any) Source: stdlib.ngs:1008
Successful match constructor
init(mf:MatchFailure, data:Any, pattern:Any) Source: stdlib.ngs:1011
Unsuccessful constructor
init(mc:MatchContext, root:Any)experimental Source: stdlib.ngs:1024
Undocumented
init(n:Not, pattern:Any) Source: stdlib.ngs:1068
Undocumented
init(pa:PatternAction, pattern:Any, action:Any)experimental Source: stdlib.ngs:1094
Undocumented
init(c:Capture, pattern:Any=method) Source: stdlib.ngs:1131
Make a pattern that captures the matching value. The matched value will be stored in MatchContext.positional

Parameters

patternOptional pattern to match. Defaults to Any.

Example

m = [1,2] =~ Capture([Capture(Int), Capture(Int)])  # m.matches =~ [Arr, 1, 2]
init(c:Capture, name:Str, pattern:Any=method) Source: stdlib.ngs:1142
Make a pattern that captures the matching value. The matched value will be stored in MatchContext.named[name]

Parameters

patternOptional pattern to match. Defaults to Any.

Example

m = {"a": 1, "b": 2} =~ {"a": Capture("arg1"), "b": Capture("arg2")}; m.named.arg1 + m.named.arg2  # 3
m = {"a": 1, "b": 2} =~ {"a": Capture("arg1", Int), "b": Capture("arg2", Str)}  # Doesn't match - b is Int
init(ie:IfExists, pattern:Any) Source: stdlib.ngs:1179
Undocumented
init(b:Branch, pattern:Any) Source: stdlib.ngs:1192
Pattern for trying all possible branches. Always reports positive match.
init(t:Transformed, transformation:Fun, pattern:Any) Source: stdlib.ngs:1208
Undocumented
init(r:Repeat, pattern:Any, count:NumRange) Source: stdlib.ngs:1299
Undocumented
init(r:Repeat, pattern:Any, count:Int) Source: stdlib.ngs:1303
Undocumented
init(r:Repeat, pattern:Any) Source: stdlib.ngs:1305
Undocumented
init(ap:AtPath, path_pattern:Any, value_pattern:Any) Source: stdlib.ngs:1350
Undocumented
init(rp:ResetPath, pattern:Any)experimental Source: stdlib.ngs:1405
Undocumented
init(al:ArrLike) Source: stdlib.ngs:1874
Undocumented
init(al:ArrLike, field:Str=null) Source: stdlib.ngs:1880
Throws NotImplemented if field is specified

Parameters

fieldDEPRECATED name of the field that holds the underlying array.
init(al:ArrLike, e:Eachable1) Source: stdlib.ngs:1885
Undocumented
init(al:ArrLike, arr:Arr) Source: stdlib.ngs:1890
Undocumented
init(a:AnyOf, *alternatives:Arr) Source: stdlib.ngs:1955
Initializes AnyOf with the given alternatives.
init(a:AllOf, *items:Arr) Source: stdlib.ngs:1996
Initializes AllOf with the given items.
init(hl:HashLike, h:Hash=null) Source: stdlib.ngs:2106
Create a HashLike.

Parameters

hIf provided, used as initial value.

Example

HashLike(%{a aha b bee}) # <HashLike a=aha b=bee>
init(hl:DeprecatedTopLevelHashlike, deprecated_field:Any, h:Hash=null) Source: stdlib.ngs:2165
Create a HashLike.

Parameters

hIf provided, used as initial value.

Example

HashLike(%{a aha b bee}) # <HashLike a=aha b=bee>
init(s:Set) Source: stdlib.ngs:2182
Initialize a set
init(s:Set, e:Eachable1) Source: stdlib.ngs:2187
Convert array to set
init(hook:Hook) Source: stdlib.ngs:2351
Hook constructor.

Returns

Hook
init(e:CError, errno:Int, message:Str) Source: stdlib.ngs:2508
CError constructor. In addition to storing message field, adds errno and errno_name fields.
init(e:CError, message:Str) Source: stdlib.ngs:2514
CError constructor. In addition to storing message field, adds errno and errno_name fields.
init(e:LockFail, op:Str, code:Int, msg:Str) Source: stdlib.ngs:2533
Initialize LockFail exception.
init(l:Lock) Source: stdlib.ngs:2537
Initialize Lock. Creates and initializes pthread_mutex.
init(l:ReentrantLock) Source: stdlib.ngs:2583
Initialize Lock. Creates and initializes PTHREAD_MUTEX_RECURSIVE pthread_mutex.
init(r:Range, start:Any, end:Any, include_start:Any=true, include_end:Any=false, step:Any=1) Source: stdlib.ngs:2610
Range constructor. Throws InstantiatingAbstractType if r is exactly of type Range (not a sub-type).
init(b:FullBox, *args:Arr) Source: stdlib.ngs:4202
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) Source: stdlib.ngs:4215
FullBox constructor. Saves val into .val

Example

# Simplified code from the_one() method:
ret = EmptyBox()
something.each(F(elt) {
	if elt =~ pattern {
		ret throws ElementNotFound("the_one() had more than one match")
	}
	ret = FullBox(elt)
})
not(ret) throws ElementNotFound("the_one() had no matches")
ret.val # Has the value
init(re:ResultsException, msg:Str, results:Results) Source: stdlib.ngs:4407
Undocumented
init(s:Stats, e:Eachable1) Source: stdlib.ngs:5181
Makes Stats, with each element in the array counted as if push()ed

Example

Stats(['a', 'a', 'b']).Hash()  # {'a': 2, 'b': 1}
Stats("AABC").Hash()  # {A=2, B=1, C=1}
init(t:Thread, name:Str, f:Fun, arg:Any) Source: stdlib.ngs:5247
Creates and runs a thread. The code that the created thread runs is f, which is passed arg.
init(t:Thread, f:Fun, arg:Any) Source: stdlib.ngs:5275
Creates and runs a thread. The code that the created thread runs is f, which is passed arg.
init(t:Thread, f:Fun) Source: stdlib.ngs:5280
Creates and runs a thread. The code that the created thread runs is f without arguments.
init(t:Thread, name:Str, f:Fun) Source: stdlib.ngs:5285
Creates and runs a thread. The code that the created thread runs is f without arguments.
init(ee:ExitException, message:Str, exit_code:Int=1) Source: stdlib.ngs:5441
Initializes ExitException.
init(ee:ExitException, exit_code:Int=1) Source: stdlib.ngs:5445
Undocumented
init(p:Path, s:Str) Source: stdlib.ngs:5657
Path constructor

Parameters

spath
init(p:Path, other:Path) Source: stdlib.ngs:5663
Path constructor. Duplicates other Path.

Parameters

otherPath to duplicate
init(t:TmpFsObj, cleanup_policy:CleanupPolicy=RemoveCleanupPolicy()) Source: stdlib.ngs:5867
Creates temporary file using `mktemp` and arranges deletion of the file upon exit from the NGS script.
init(t:TmpFile, cleanup_policy:CleanupPolicy=RemoveCleanupPolicy()) Source: stdlib.ngs:5880
Undocumented
init(t:TmpDir, cleanup_policy:CleanupPolicy=RemoveCleanupPolicy()) Source: stdlib.ngs:5885
Undocumented
init(p:Program, name:Str) Source: stdlib.ngs:5947
External Program
init(pp:ProcessesPipeline, cp:CommandsPipeline) Source: stdlib.ngs:5971
Undocumented
init(pr:ProcessRedir, cr:CommandRedir) Source: stdlib.ngs:5980
Undocumented
init(pr:ProcessRedir, fd:Any, marker:Any, datum:Any) Source: stdlib.ngs:5982
Undocumented
init(pr:ProcessRedir, fd:Any, marker:Any, datum:File) Source: stdlib.ngs:5984
Undocumented
init(pipe:Pipe) Source: stdlib.ngs:6120
Pipe constructor. Create UNIX pipe using PIPE(2). Throws PipeCreateFail if pipe can not be created.

Example

p = Pipe()
init(pipe:Pipe, other:Pipe) Source: stdlib.ngs:6132
Initializes Pipe, copying read_fd and write_fd from another Pipe.

Example

my_pipe = ...
second_pipe = Pipe(my_pipe)
init(f:File, path:Str) Source: stdlib.ngs:6190
Create File object from the given path. The file is not open.

Example

f = File('/tmp/myfile')
init(f:File, fd:Int) Source: stdlib.ngs:6196
Create File object from the given file descriptor.
init(f:File, path:Path) Source: stdlib.ngs:6200
Undocumented
init(r:CommandRedir, fd:Any, marker:Any, datum:Any) Source: stdlib.ngs:6334
Initialize CommandRedir object. Used internally for commands syntax.

Automatically called by NGS for syntax

$(my_prog >my_file)
init(r:CommandRedir, fd:Any, marker:Any, datum:Null) Source: stdlib.ngs:6341
Throw exception whend redirecting to/from null
init(p:Process, c:Command) Source: stdlib.ngs:6461
Process constructor. Initializes fields.
init(s:SubSeq, val:Any) Source: stdlib.ngs:7466
SubSeq constructor
init(lines:Lines, s:Str) Source: stdlib.ngs:7854
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

Example

"xx\nyy".lines()  # %[xx yy]
init(lines:Lines, backtrace:Backtrace, parent_backtrace:Any=null) Source: stdlib.ngs:8041
Convert Backtrace to human-readable format

Example

Lines(bt).echo()
init(t:Time) Source: stdlib.ngs:8196
Initialize Time object with current time.
init(t:Time, epoch:Int) Source: stdlib.ngs:8201
Initialize Time object with the given epoch time.
init(t:Time, s:Str, format:Str) Source: stdlib.ngs:8205
Undocumented
init(t:Time, s:Str) Source: stdlib.ngs:8216
Parse known date/time formats
init(d:Duration, seconds:Int) Source: stdlib.ngs:8276
Undocumented
init(rd:ResDef, anchor:Any)
Undocumented
init(rd:ResDef)
Creates resource definition with empty Hash anchor.
init(i:MapIter, upstream_iter:Iter, mapper:Fun)
EXPERIMENTAL! Do not use!
init(i:FilterIter, upstream_iter:Iter, pattern:Any)
EXPERIMENTAL! Do not use!
init(i:FunIter, f:Fun)
Undocumented
init(i:ConstIter, val:Any)
Constant iterator constructor.

Parameters

valthe constant value to use in next() and peek()
init(i:RangeIter, r:NumRange)
Initialize RangeIter. Will throw NotImplemented if r.start or r.step are not Int
init(i:ArrIter, arr:Arr)
ArrIter constructor.

Example

i = ArrIter([10, 20, 30])
init(i:HashIter, h:Hash)
HashIter constructor.

Example

i = HashIter({"a": 1, "b": 2})
init(r:Res, def:ResDef, props:Hash)
Stores def and props in r
init(rd:AWS::ResDef, **kw:Hash)
Initialize ResDef from kw. Defaults: null for .regions and empty hash for .Tags
init(rd:AWS::ResDef, _ngs_name:Str)
Initialize ResDef from _ngs_name. Sets .regions to null, .Tags to empty hash and .Name to _ngs_name.
init(rd:AWS::ResDef, _ngs_tags:Hash)
Initialize ResDef from _ngs_tags. Sets .regions to null and .Tags to _ngs_tags.
init(rd:AWS::SecGroup, anchor:Arr)deprecated
Initialize SecGroup from Arr of [name, vpc_id].
init(rd:AWS::SecGroup, Name:Str, VpcId:Any)
Initialize SecGroup from security group name and vpc.

Example

AWS::SecGroup("https-server", AWS::Vpc(...))
init(rd:AWS::Instance, **kwargs:Hash)
Initialize Instance (ResDef) from kwargs
init(rd:AWS2::ResDef, **kw:Hash)
Initialize ResDef from kw. Defaults: null for ._Region and empty hash for .Tags
init(rd:AWS2::ResDef, _ngs_tags:Hash)
Initialize ResDef from _ngs_tags. Sets ._Region to null and .Tags to _ngs_tags.
init(p:AWS2::Parameter, res_type:Type, param_name:Str, param_value:Any)
Undocumented
init(rd:AWS2::SecGroup, GroupName:Str, VpcId:Any)
Initialize SecGroup from security group name and vpc.

Example

AWS2::SecGroup("https-server", AWS2::Vpc(...))
init(rd:AWS2::Instance, **kwargs:Hash)
Initialize Instance (ResDef) from kwargs
init(rd:AWS2::Zone, Name:Str)
Undocumented
init(pmy:ParamsMatchY, args:Arr, kwargs:Hash)
Undocumented
init(ds:DelimStr, s:Str, delim:Str=':')
DelimStr constructor
init(ds:DelimStr, a:Arr, delim:Str=':')
DelimStr constructor
init(n:Doc::Node, name:Str, children:Arr=null, **attrs:Hash)
Initialize document node

Example

Doc::Node('span', class='inline-param') with [
	Doc::Text(param.name)
	Doc::Text(':')
	Doc::Text(param.type.name)
	...
]
init(g:Doc::Group, children:Arr=null, **attrs:Hash)
Initialize document nodes group

Example

Doc::Group() with [
	Doc::Text('something')
	...
]
init(t:Doc::Textual, txt:Str)
Initialize text fragment of a document

Example

Doc::Text(':')
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

Parameters

namename of the table for display and for configuration purposes
rows_hashesrows, each row is a Hash
init(t:Table, rows_hashes:Arr)
Create unnamed table containing provided rows
init(tv:TableView, name:Any=null, view_name:Str=null, columns:Arr=null)
Undocumented
init(tvc:TableViewColumn)
Undocumented
init(stvc:SimpleTableViewColumn, name:Str)
Undocumented
init(c:_Cell, val:Any)
Any unknown value is a table cell with one row, Str(val)
init(c:_Cell, val:Null)
A null value is a table cell with one row, "-"
init(c:_Cell, val:Eachable1)
An Eachable1 value is a table cell with all elements one below the other. Converts elements to strings using _Cell().
init(c:_Cell, val:Eachable2)
An Eachable2 value is a table cell with all pairs one below the other. Converts values to strings using _Cell().
init(c:_Cell, val:Any, width:Int)
Make a cell of given width. Uses _Cell(val).
init(t:Table, name:Any=null)
Initialize rows to an empty array
init(t:Table, name:AnyOf(Str, Null), rows_hashes:Arr)
Create named table containing provided rows

Parameters

namename of the table for display and for configuration purposes
rows_hashesrows, each row is a Hash
init(t:Table, rows_hashes:Arr)
Create unnamed table containing provided rows
init(t:Table, row_hash:Hash)
Create single-line table
init(tf:TestFail, message:Str)
Initialize TestFail.
init(tr:TestsResults)
Undocumented
init(ctx:TrContext, root:Any, transformation:Any)
Undocumented
init(cmd:TrCommand, x:Any, ctx:TrContext)
Undocumented
init(mp:MethodParams, f:Fun)
Undocumented
init(mp:MethodParam, h:Hash)
Initialize MethodParam from params() array element
init(pf:ProcessFail, process:Process)
Undocumented
init(tvi:ThisVersionIndex)
Undocumented
init(md:MarkdownDescription, tvi:ThisVersionIndex, output_name:Str, file_path:Path)
Undocumented
init(nd:NamespaceDescription, namespace:Hash)
Undocumented
init(nd:NamespaceDescription, containing_nd:NamespaceDescription, name:Str, namespace:Hash)
Undocumented
init(gnd:GlobalNamespaceDescription, this_version_index:Any)
Undocumented
init(td:TypeDescription, containing_nd:NamespaceDescription, name:Str, type:Type)
Undocumented
init(mmd:MultiMethodDescription, containing_nd:NamespaceDescription, name:Str, multimethod:MultiMethod)
Undocumented
init(md:MethodDescription, method:Fun)
Undocumented
init(md:MethodDescription, containing_nd:NamespaceDescription, name:Str, mmd:MultiMethodDescription, method:Fun)
Undocumented
init(md:MethodDescription, containing_nd:NamespaceDescription, name:Str, method:Fun)
Undocumented
init(t:Terminal, fd_in:Int, fd_out:Int)
Undocumented
init(t:Terminal)
Undocumented
init(at:AnsiTerminal, *args:Arr)
Undocumented