Loops/Wrong ranges: Difference between revisions
→{{header|langur}}
Langurmonkey (talk | contribs) |
Langurmonkey (talk | contribs) |
||
Line 696:
You don't always have to convert a range to a series explicitly. Since 0.6.15, the functions map(), fold(), foldfrom(), and zip() accept ranges in place of arrays.
In the following examples, we could have just started with an array of arrays, but following the Python example, we process the .data string into a table.
{{trans|Python}}
Line 713 ⟶ 715:
END
var .table = map(f(.s) split(RE/\s\s+/, replace(.s, RE:m/^\s+/)), split("\n", .data))
for .i in 2..len(.table) {
Line 747:
END
var .table = map(f(.s) split(RE/\s\s+/, replace(.s, RE:m/^\s+/)), split("\n", .data))
val .f = toNumber
for .i in 2..len(.table) {
.table[.i] = map([
}
|