lines multimethod

Methods

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

Returns

Arr
lines(s:Str, cb:Fun) Source: stdlib.ngs:3594
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(f:File, cb:Fun) Source: stdlib.ngs:4553
Iterate over lines of the file

Parameters

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

Returns

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

Returns

Arr of Str
lines(p:Process) Source: stdlib.ngs:5338
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:5346
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:5354
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:5362
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