Loop over multiple arrays simultaneously: Difference between revisions
Content added Content deleted
(Add lang example) |
(Improve lang example: Replace first array with array of char values & Remove trailing s from last line) |
||
Line 2,439: | Line 2,439: | ||
=={{header|Lang}}== |
=={{header|Lang}}== |
||
<syntaxhighlight lang="lang"> |
<syntaxhighlight lang="lang"> |
||
$a $= [a |
$a $= [a, b, c] # Char values |
||
$b $= [A\e, B\e, C\e] |
$b $= [A\e, B\e, C\e] # Text values |
||
$c $= [1, 2, 3] |
$c $= [1, 2, 3] # Int values |
||
# Repeat loop |
# Repeat loop |
||
Line 2,458: | Line 2,458: | ||
# Foreach function with combinator |
# Foreach function with combinator |
||
fn.arrayForEach(fn.arrayZip($a, $b, $c), fn.combB(fn.println, fn.combC3(fn.arrayReduce, fn.concat, \e))) |
fn.arrayForEach(fn.arrayZip($a, $b, $c), fn.combB(fn.println, fn.combC3(fn.arrayReduce, fn.concat, \e))) |
||
</syntaxhighlight> |
</syntaxhighlight> |
||