Loops/Wrong ranges: Difference between revisions

Content added Content deleted
Line 1,958: Line 1,958:


=={{header|langur}}==
=={{header|langur}}==
In the following example, we could have just started with a list of lists, but following the Python example, we process the .data string into a table.
In the following example, we could have just started with a list of lists, but following the Python example, we process a data string into a table.


{{trans|Python}}
{{trans|Python}}
Line 1,975: Line 1,975:


var .table = submatches(RE/([^ ]+) +([^ ]+) +([^ ]+) +(.+)\n?/, .data)
var .table = submatches(RE/([^ ]+) +([^ ]+) +([^ ]+) +(.+)\n?/, .data)

val .f = f number .x
val .f = fn(.x) number .x
for .i in 2..len(.table) {
for .i in 2..len(.table) {
.table[.i] = map [.f, .f, .f, _], .table[.i]
.table[.i] = map [.f, .f, .f, _], .table[.i]
Line 1,990: Line 1,991:
}
}
}
}
}
}</syntaxhighlight>
</syntaxhighlight>


{{out}}
{{out}}