lines multimethod

Methods

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

Returns

Arr
lines(s:Str, cb:Fun) Source: stdlib.ngs:4988
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:4995
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:6239
Iterate over lines of the file

Parameters

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

Returns

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

Returns

Arr of Str
lines(p:Process) Source: stdlib.ngs:7146
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:7152
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:7160
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:7168
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