Loops/Wrong ranges: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
Langurmonkey (talk | contribs) |
||
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 |
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 = |
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> |
|||
{{out}} |
{{out}} |