lines multimethod

Methods

lines(s:Str) Source: stdlib.ngs:4571
Split s to strings using end-of-line separators. Same as Lines(s).Arr()

Returns

Arr
lines(s:Str, cb:Fun) Source: stdlib.ngs:4578
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.

Parameters

cbFunction to be called with each line
lines() Source: stdlib.ngs:4585
Read all data from a file referenced by file descriptor 0 (stdin) and split into lines

Returns

Arr
lines(f:File, cb:Fun) Source: stdlib.ngs:5798
Iterate over lines of the file

Parameters

fClosed File
cbfunction to call with successive lines from the file
lines(f:File) Source: stdlib.ngs:5814
Get all lines of the file

Returns

Arr of Str
lines(f:File, lines_:Arr) Source: stdlib.ngs:5819
Write given lines to the file. Overwrites the file.

Returns

Arr of Str
lines(p:Process) Source: stdlib.ngs:6664
Wait for the process and return lines of its stdout.

Returns

Arr of Str

Example

$(seq 10 2 20).lines().map(Int)  # [10,12,14,16,18,20]
lines(p:Process, cb:Fun) Source: stdlib.ngs:6670
Iterate lines of Process' stdout, calling cb with successive lines. Warning: current implementation waits for the process to finish, accumulates all its stdout, and only then starts calling cb for each line.
lines(pp:ProcessesPipeline) Source: stdlib.ngs:6678
Wait for cp and return lines of stdout of the last process.

Returns

Arr of Str

Example

$(seq 3 | tac).lines().map(Int)  # [3,2,1]
lines(pp:ProcessesPipeline, cb:Fun) Source: stdlib.ngs:6686
Wait for pp and return call cb for each line of stdout of last process. Warning: current implementation waits for the processes to finish, accumulates all stdout of the last process, and only then starts calling cb for each line.

Returns

Arr of Str
lines(f:MaybeFile, cb:Fun)
Like lines(File) but cb is never called if the file is not present