Append numbers at same position in strings: Difference between revisions

Added C3
(Added AutoHotkey)
(Added C3)
 
(40 intermediate revisions by 27 users not shown)
Line 2:
 
;Task:
<br>Let givenGiven three listlists:
<br>list1 = [1,2,3,4,5,6,7,8,9]
<br>list2 = [10,11,12,13,14,15,16,17,18]
<br>list3 = [19,20,21,22,23,24,25,26,27]
<br>AppendTurn the numbers atthem sameinto positionstrings inand stringsconcatenate them.
<br>The result should be:
<br>list = [11019,21120,31221,41322,51423,61524,71625,81726,91827]
 
=={{header|11l}}==
<syntaxhighlight lang="11l">V list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9]
V list2 = [10, 11, 12, 13, 14, 15, 16, 17, 18]
V list3 = [19, 20, 21, 22, 23, 24, 25, 26, 27]
 
print(zip(list1, list2, list3).map((n1, n2, n3) -> String(n1)‘’n2‘’n3))</syntaxhighlight>
 
{{out}}
<pre>
[11019, 21120, 31221, 41322, 51423, 61524, 71625, 81726, 91827]
</pre>
 
=={{header|Ada}}==
<langsyntaxhighlight Adalang="ada">with Ada.Text_Io;
with Ada.Strings.Fixed;
 
Line 42 ⟶ 54:
 
Put (List); New_Line;
end Append_Numbers;</langsyntaxhighlight>
{{out}}
<pre>
Line 49 ⟶ 61:
 
=={{header|ALGOL 68}}==
<langsyntaxhighlight lang="algol68">BEGIN # form a list of strings by concatenating numbers from 3 lists #
[]INT list1 = ( 1, 2, 3, 4, 5, 6, 7, 8, 9 )
, list2 = ( 10, 11, 12, 13, 14, 15, 16, 17, 18 )
Line 64 ⟶ 76:
OD;
print( ( " ]", newline ) )
END</langsyntaxhighlight>
{{out}}
<pre>
[ 11019, 21120, 31221, 41322, 51423, 61524, 71625, 81726, 91827 ]
</pre>
 
=={{header|APL}}==
{{works with|Dyalog APL}}
<syntaxhighlight lang="apl">list1←1 2 3 4 5 6 7 8 9
list2←10 11 12 13 14 15 16 17 18
list3←19 20 21 22 23 24 25 26 27
append←⍎¨∘(,/)∘(⍕¨)∘(⍉↑)
append list1 list2 list3</syntaxhighlight>
{{out}}
<pre>11019 21120 31221 41322 51423 61524 71625 81726 91827</pre>
 
=={{header|Arturo}}==
 
<syntaxhighlight lang="arturo">list1: [1,2,3,4,5,6,7,8,9]
list2: [10,11,12,13,14,15,16,17,18]
list3: [19,20,21,22,23,24,25,26,27]
 
0..dec size list1 | map'i -> join @[list1\[i] list2\[i] list3\[i]]
| print</syntaxhighlight>
 
{{out}}
 
<pre>11019 21120 31221 41322 51423 61524 71625 81726 91827</pre>
 
=={{header|AutoHotkey}}==
<langsyntaxhighlight AutoHotkeylang="autohotkey">list1 := [1,2,3,4,5,6,7,8,9]
list2 := [10,11,12,13,14,15,16,17,18]
list3 := [19,20,21,22,23,24,25,26,27]
Line 80 ⟶ 115:
for i, v in list4
result .= v ", "
MsgBox % "[" trim(result, ", ") "]"</langsyntaxhighlight>
{{out}}
<pre>[11019, 21120, 31221, 41322, 51423, 61524, 71625, 81726, 91827]</pre>
 
=={{header|AWK}}==
<syntaxhighlight lang="awk">
# syntax: GAWK -f APPEND_NUMBERS_AT_SAME_POSITION_IN_STRINGS.AWK
BEGIN {
n1 = split("1,2,3,4,5,6,7,8,9",list1,",")
n2 = split("10,11,12,13,14,15,16,17,18",list2,",")
n3 = split("19,20,21,22,23,24,25,26,27",list3,",")
if (n1 != n2 || n1 != n3) {
print("error: arrays must be same length")
exit(1)
}
for (i=1; i<=n1; i++) {
list[i] = list1[i] list2[i] list3[i]
printf("%s ",list[i])
}
printf("\n")
exit(0)
}
</syntaxhighlight>
{{out}}
<pre>
11019 21120 31221 41322 51423 61524 71625 81726 91827
</pre>
 
=={{header|BASIC}}==
==={{header|BASIC256}}===
{{trans|FreeBASIC}}
<syntaxhighlight lang="BASIC256">arraybase 1
dim list1 = {1,2,3,4,5,6,7,8,9}
dim list2 = {10,11,12,13,14,15,16,17,18}
dim list3 = {19,20,21,22,23,24,25,26,27}
dim catlist(9)
 
for i = 1 to 9
temp$ = string(list1[i]) + string(list2[i]) + string(list3[i])
catlist[i] = FromRadix(temp$,10)
print catlist[i]; " ";
next i</syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
 
 
==={{header|Run BASIC}}===
{{trans|FreeBASIC}}
<syntaxhighlight lang="lb">dim list1(9)
data 1,2,3,4,5,6,7,8,9
for i = 1 to 9
read list1(i)
next i
dim list2(9)
data 10,11,12,13,14,15,16,17,18
for i = 1 to 9
read list2(i)
next i
dim list3(9)
data 19,20,21,22,23,24,25,26,27
for i = 1 to 9
read list3(i)
next i
 
dim catlist(9)
for i = 1 to 9
temp$ = str$(list1(i)) + str$(list2(i)) + str$(list3(i))
catlist(i) = val(temp$)
print catlist(i); " ";
next i</syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
 
 
==={{header|Yabasic}}===
{{trans|FreeBASIC}}
<syntaxhighlight lang="yabasic">// Rosetta Code problem: http://rosettacode.org/wiki/Append_numbers_at_same_position_in_strings
// by Jjuanhdez, 09/2022
 
dim list1(9)
data 1,2,3,4,5,6,7,8,9
for i = 1 to 9
read list1(i)
next i
dim list2(9)
data 10,11,12,13,14,15,16,17,18
for i = 1 to 9
read list2(i)
next i
dim list3(9)
data 19,20,21,22,23,24,25,26,27
for i = 1 to 9
read list3(i)
next i
 
dim catlist(9)
for i = 1 to 9
temp$ = str$(list1(i)) + str$(list2(i)) + str$(list3(i))
catlist(i) = val(temp$)
print catlist(i), " ";
next i</syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
 
=={{header|C}}==
<langsyntaxhighlight lang="c">#include<stdio.h>
#include<stdlib.h>
 
Line 93 ⟶ 228:
for(i=0;i<9;i++) printf( "%d%d%d ", list[0][i], list[1][i], list[2][i] );
return 0;
}</langsyntaxhighlight>
{{out}}<pre>11019 21120 31221 41322 51423 61524 71625 81726 91827</pre>
 
=={{header|C3}}==
<syntaxhighlight lang="c3">import std::io;
import std::collections::list;
 
fn void main()
{
int[9] list1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int[9] list2 = { 10, 11, 12, 13, 14, 15, 16, 17, 18 };
int[9] list3 = { 19, 20, 21, 22, 23, 24, 25, 26, 27 };
List(<String>) list;
list.temp_init();
for (int i = 0; i < 9; i++)
{
list.push(string::tformat("%d%d%d", list1[i], list2[i], list3[i]));
}
io::printn(list);
}</syntaxhighlight>
{{out}}<pre>[11019, 21120, 31221, 41322, 51423, 61524, 71625, 81726, 91827]</pre>
 
=={{header|CLU}}==
<syntaxhighlight lang="clu">append = proc (lists: sequence[sequence[int]]) returns (sequence[int])
n_lists: int := sequence[sequence[int]]$size(lists)
n_items: int := sequence[int]$size(lists[1])
out_list: array[int] := array[int]$predict(1,n_items)
for i: int in int$from_to(1, n_items) do
item: string := ""
for j: int in int$from_to(1, n_lists) do
item := item || int$unparse(lists[j][i])
end
array[int]$addh(out_list, int$parse(item))
end
return(sequence[int]$a2s(out_list))
end append
 
start_up = proc ()
list1 = sequence[int]$[1,2,3,4,5,6,7,8,9]
list2 = sequence[int]$[10,11,12,13,14,15,16,17,18]
list3 = sequence[int]$[19,20,21,22,23,24,25,26,27]
lists = sequence[sequence[int]]$[list1,list2,list3]
po: stream := stream$primary_output()
for n: int in sequence[int]$elements(append(lists)) do
stream$puts(po, int$unparse(n) || " ")
end
end start_up</syntaxhighlight>
{{out}}
<pre>11019 21120 31221 41322 51423 61524 71625 81726 91827</pre>
 
=={{header|Delphi}}==
{{works with|Delphi|6.0}}
{{libheader|SysUtils}}
 
<syntaxhighlight lang="Delphi">
const List1: array [0..8] of integer = (1, 2, 3, 4, 5, 6, 7, 8, 9);
const list2: array [0..8] of integer = (10, 11, 12, 13, 14, 15, 16, 17, 18);
const list3: array [0..8] of integer = (19, 20, 21, 22, 23, 24, 25, 26, 27);
 
function GetAppendNumbers: string;
var I: integer;
begin
Result:='List = [';
for I:=0 to High(List1) do
begin
Result:=Result+IntToStr(List1[I])+IntToStr(List2[I])+IntToStr(List3[I]);
if I=High(List1) then Result:=Result+']'
else Result:=Result+',';
end;
end;
</syntaxhighlight>
 
{{out}}
 
<pre>
List = [11019,21120,31221,41322,51423,61524,71625,81726,91827]
</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight lang=easylang>
list1[] = [ 1 2 3 4 5 6 7 8 9 ]
list2[] = [ 10 11 12 13 14 15 16 17 18 ]
list3[] = [ 19 20 21 22 23 24 25 26 27 ]
#
for i to len list1[]
s$ = list1[i] & list2[i] & list3[i]
r[] &= number s$
.
print r[]
</syntaxhighlight>
 
=={{header|F_Sharp|F#}}==
<syntaxhighlight lang="fsharp">
// Append numbers at same position in strings. Nigel Galloway: December 29th., 2021
let rec fG n g l=seq{match n,g,l with (n::x,g::y,l::z)->yield int((string n)+(string g)+(string l)); yield! fG x y z |_->()}
fG [1;2;3;4;5;6;7;8;9] [10;11;12;13;14;15;16;17;18] [19;20;21;22;23;24;25;26;27] |> Seq.iter(printf "%d "); printfn ""
</syntaxhighlight>
{{out}}
<pre>
11019 21120 31221 41322 51423 61524 71625 81726 91827
</pre>
 
=={{header|Factor}}==
{{works with|Factor|0.99 2021-06-02}}
<langsyntaxhighlight lang="factor">USING: kernel math.parser math.ranges present prettyprint
sequences ;
 
27 [1,b] 9 cut 9 cut [ [ present ] tri@ 3append dec> ] 3map .</langsyntaxhighlight>
{{out}}
<pre>
Line 108 ⟶ 342:
 
=={{header|FreeBASIC}}==
<langsyntaxhighlight lang="freebasic">dim as integer list1(1 to 9) = {1,2,3,4,5,6,7,8,9}
dim as integer list2(1 to 9) = {10,11,12,13,14,15,16,17,18}
dim as integer list3(1 to 9) = {19,20,21,22,23,24,25,26,27}
Line 118 ⟶ 352:
catlist(i) = val(temp)
print catlist(i);" ";
next i</langsyntaxhighlight>
{{out}}<pre>11019 21120 31221 41322 51423 61524 71625 81726 91827</pre>
 
 
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
NSUInteger i
CFArrayRef list1, list2, list3
 
list1 = @[@"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9"]
list2 = @[@"10", @"11", @"12", @"13", @"14", @"15", @"16", @"17", @"18"]
list3 = @[@"19", @"20", @"21", @"22", @"23", @"24", @"25", @"26", @"27"]
 
printf @"[\b"
for i = 0 to 8
CFStringRef format : if i < 8 then format = @"%@%@%@, \b" else format = @"%@%@%@]"
printf format, list1[i], list2[i], list3[i]
next
 
HandleEvents
</syntaxhighlight>
{{output}}
<pre>
[11019, 21120, 31221, 41322, 51423, 61524, 71625, 81726, 91827]
</pre>
 
 
=={{header|Go}}==
<syntaxhighlight lang="go">package main
 
import "fmt"
 
func main() {
list1 := [9]int{1, 2, 3, 4, 5, 6, 7, 8, 9}
list2 := [9]int{10, 11, 12, 13, 14, 15, 16, 17, 18}
list3 := [9]int{19, 20, 21, 22, 23, 24, 25, 26, 27}
var list [9]int
for i := 0; i < 9; i++ {
list[i] = list1[i]*1e4 + list2[i]*1e2 + list3[i]
}
fmt.Println(list)
}</syntaxhighlight>
 
{{out}}
<pre>
[11019 21120 31221 41322 51423 61524 71625 81726 91827]
</pre>
 
=={{header|Haskell}}==
<syntaxhighlight lang="haskell">main :: IO ()
main =
mapM_ putStrLn $
zipWith3
(\ x y z -> [x, y, z] >>= show)
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[10, 11, 12, 13, 14, 15, 16, 17, 18]
[19, 20, 21, 22, 23, 24, 25, 26, 27]</syntaxhighlight>
 
or more flexibly (allowing for an arbitrary number of zipped lists) in terms of ZipList:
<syntaxhighlight lang="haskell">import Control.Applicative
 
main :: IO ()
main =
mapM_ putStrLn $
getZipList $
(\x y z -> [x, y, z] >>= show) <$>
ZipList [1, 2, 3, 4, 5, 6, 7, 8, 9] <*>
ZipList [10, 11, 12, 13, 14, 15, 16, 17, 18] <*>
ZipList [19, 20, 21, 22, 23, 24, 25, 26, 27]</syntaxhighlight>
 
{{Out}}
<pre>11019
21120
31221
41322
51423
61524
71625
81726
91827</pre>
 
=={{header|J}}==
<syntaxhighlight lang="j">list1=. 1 2 3 4 5 6 7 8 9
list2=. 10 11 12 13 14 15 16 17 18
list3=. 19 20 21 22 23 24 25 26 27
-.&' '@":"1 list1 ,. list2 ,. list3</syntaxhighlight>
{{out}}
<pre>11019
21120
31221
41322
51423
61524
71625
81726
91827</pre>
 
=={{header|jq}}==
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<langsyntaxhighlight lang="jq">def list1 : [ range(1;10) ];
def list2 : [ range(10; 19)];
def list3 : [ range(19; 28) ];
Line 130 ⟶ 459:
[list1, list2, list3]
| transpose
| map( map(tostring) | add | tonumber)</langsyntaxhighlight>
{{out}}
<pre>
[11019,21120,31221,41322,51423,61524,71625,81726,91827]
</pre>
 
 
=={{header|Julia}}==
<langsyntaxhighlight lang="julia">list1 = [1,2,3,4,5,6,7,8,9]
list2 = [10,11,12,13,14,15,16,17,18]
list3 = [19,20,21,22,23,24,25,26,27]
 
println([prod(string(n) for n in z) for z in zip(list1, list2, list3)]) # ["11019", "21120", "31221", "41322", "51423", "61524", "71625", "81726", "91827"]
</syntaxhighlight>
</lang>
 
=={{header|Lambdatalk}}==
<syntaxhighlight lang="scheme">
Using a function returning an array
 
{def append_numbers
{def append_numbers.rec
{lambda {:a :b :c :d}
{if {A.empty? :a}
then :d
else {append_numbers.rec {A.rest :a} {A.rest :b} {A.rest :c}
{A.addlast! {A.first :a}{A.first :b}{A.first :c} :d}}
}}}
{lambda {:a :b :c}
{append_numbers.rec :a :b :c {A.new}}}}
-> append_numbers
 
 
{append_numbers
{A.new {S.serie 1 9}}
{A.new {S.serie 10 18}}
{A.new {S.serie 19 27}}}
-> [11019,21120,31221,41322,51423,61524,71625,81726,91827]
 
or a map returning a sequence
 
{S.map {{lambda {:a :b :c :i}
{A.get :i :a}{A.get :i :b}{A.get :i :c}}
{A.new {S.serie 1 9}}
{A.new {S.serie 10 18}}
{A.new {S.serie 19 27}}
} {S.serie 0 8}}
-> 11019 21120 31221 41322 51423 61524 71625 81726 91827
</syntaxhighlight>
 
=={{header|Lua}}==
<syntaxhighlight lang="lua">
do -- form a list of strings by concatenating numbers from 3 lists
local list1, list2, list3 = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
, { 10, 11, 12, 13, 14, 15, 16, 17, 18 }
, { 19, 20, 21, 22, 23, 24, 25, 26, 27 }
local result = {}
for i = 1, #list1 do
result[ i ] = list1[ i ]..list2[ i ]..list3[ i ]
end
print( "[ "..table.concat( result, " " ).." ]" )
end
</syntaxhighlight>
{{out}}
<pre>
[ 11019, 21120, 31221, 41322, 51423, 61524, 71625, 81726, 91827 ]
</pre>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<syntaxhighlight lang="mathematica">list1 = {1, 2, 3, 4, 5, 6, 7, 8, 9};
list2 = {10, 11, 12, 13, 14, 15, 16, 17, 18};
list3 = {19, 20, 21, 22, 23, 24, 25, 26, 27};
MapThread[
FromDigits@Flatten[IntegerDigits /@ {##}] &, {list1, list2, list3}]</syntaxhighlight>
 
{{out}}<pre>
{11019,21120,31221,41322,51423,61524,71625,81726,91827}
</pre>
 
=={{header|Maxima}}==
<syntaxhighlight lang="maxima">
list1:makelist(i,i,9)$
list2:makelist(i,i,10,18)$
list3:makelist(i,i,19,27)$
block(makelist(sconcat(list1[i],list2[i],list3[i]),i,1,length(list1)),map(eval_string,%%));
</syntaxhighlight>
{{out}}<pre>
[11019,21120,31221,41322,51423,61524,71625,81726,91827]
</pre>
 
=={{header|Nim}}==
<syntaxhighlight lang="Nim">import std/strutils
 
const
List1 = [1, 2, 3, 4, 5, 6, 7, 8, 9]
List2 = [10, 11, 12, 13, 14, 15, 16, 17, 18]
List3 = [19, 20, 21, 22, 23, 24, 25, 26, 27]
 
var list: array[List1.len, int]
for i in 0..list.high:
list[i] = parseInt($List1[i] & $List2[i] & $List3[i])
 
echo "list = ", list
</syntaxhighlight>
 
{{out}}
<pre>list = [11019, 21120, 31221, 41322, 51423, 61524, 71625, 81726, 91827]
</pre>
 
=={{header|OCaml}}==
<syntaxhighlight lang="ocaml">let lists = [
["1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"];
["10"; "11"; "12"; "13"; "14"; "15"; "16"; "17"; "18"];
["19"; "20"; "21"; "22"; "23"; "24"; "25"; "26"; "27"]]
 
let reduce f = function
| h :: t -> List.fold_left f h t
| _ -> invalid_arg "reduce"
 
let () =
reduce (List.map2 (^)) lists |> String.concat ", " |> print_endline</syntaxhighlight>
{{out}}
<pre>11019, 21120, 31221, 41322, 51423, 61524, 71625, 81726, 91827</pre>
 
=={{header|Pascal}}==
The following <tt>program</tt> requires (at least) an ISO 7185-compliant processor supporting features at level&nbsp;1 (specifically “conformant array parameters” are being used).
<syntaxhighlight lang="pascal">program appendNumbersAtSamePositionInStrings(output);
 
type
wholeNumber = 0..maxInt;
 
var
i: integer;
{ Indices were chosen to ease up initialization in main block. }
list0: array[1..9] of wholeNumber;
list1: array[10..18] of wholeNumber;
list2: array[19..27] of wholeNumber;
 
{ Returns the number of digits necessary to express as decimal. }
function digitCount(i: wholeNumber): wholeNumber;
begin
{ Instead of an `if` branch you can simply write: }
i := i + ord(i = 0);
{ Remember: Argument to `ln` must be positive. }
digitCount := succ(trunc(ln(i) / ln(10)))
end;
 
{ Appends two list members in place. }
procedure append(
{ DI: Destination Index; SI: Source Index. }
var destination: array[diMin..diMax: integer] of wholeNumber;
source: array[siMin..siMax: integer] of wholeNumber
);
var
i, n: integer;
begin
{ Determine maximum index range. }
i := diMax - diMin;
if (siMax - siMin) < i then
begin
i := siMax - siMin
end;
{ NB: In Pascal `for`-loop-limits are evaluation exactly once only. }
for i := 0 to i do
begin
{ In Extended Pascal (ISO 10206) you could actually simply write: }
{ … := destination[diMin + i] * 10 pow digitCount(source[siMin + i]) }
for n := 1 to digitCount(source[siMin + i]) do
begin
destination[diMin + i] := destination[diMin + i] * 10
end;
destination[diMin + i] := destination[diMin + i] + source[siMin + i]
end
end;
 
{ Calls `append` twice. }
procedure appendTwo(
var destination: array[diMin..diMax: integer] of wholeNumber;
source0: array[si0Min..si0Max: integer] of wholeNumber;
source1: array[si1Min..si1Max: integer] of wholeNumber
);
begin
append(destination, source0);
append(destination, source1)
end;
 
{ === MAIN ============================================================= }
begin
for i := 1 to 9 do
begin
list0[i] := i
end;
for i := 10 to 18 do
begin
list1[i] := i
end;
for i := 19 to 27 do
begin
list2[i] := i
end;
appendTwo(list0, list1, list2);
for i := 1 to 9 do
begin
writeLn(list0[i])
end
end.</syntaxhighlight>
{{out}}
11019
21120
31221
41322
51423
61524
71625
81726
91827
 
=={{header|Perl}}==
<langsyntaxhighlight lang="perl">use strict;
use warnings;
 
Line 163 ⟶ 695:
map {print $f[$_][$i] } 0 .. $#f and print ' '
}
print "\n";</langsyntaxhighlight>
{{out}}
<pre>11019 21120 31221 41322 51423 61524 71625 81726 91827
Line 169 ⟶ 701:
 
=={{header|Phix}}==
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%V%V\n"</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">apply</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">apply</span><span style="color: #0000FF;">(</span><span style="color: #004600;">true</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">vslice</span><span style="color: #0000FF;">,{{</span><span style="color: #7060A8;">sq_mul</span><span style="color: #0000FF;">({</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #000000;">9</span><span style="color: #0000FF;">),</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #000000;">18</span><span style="color: #0000FF;">,</span><span style="color: #000000;">10</span><span style="color: #0000FF;">),</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #000000;">27</span><span style="color: #0000FF;">,</span><span style="color: #000000;">19</span><span style="color: #0000FF;">)},{</span><span style="color: #000000;">1e4</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1e2</span><span style="color: #0000FF;">,</span><span style="color: #000000;">1</span><span style="color: #0000FF;">})},</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #000000;">9</span><span style="color: #0000FF;">)}),</span><span style="color: #7060A8;">sum</span><span style="color: #0000FF;">),</span><span style="color: #000000;">2</span><span style="color: #0000FF;">))</span>
<!--</langsyntaxhighlight>-->
{{out}}
<pre>
Line 177 ⟶ 709:
</pre>
 
=={{header|PythonPL/M}}==
{{works with|8080 PL/M Compiler}} ... under CP/M (or an emulator)
<lang python>from functools import reduce
<syntaxhighlight lang="plm">
100H: /* FORM A LIST OF STRINGS BY CONCATENATING NUMBERS FROM 3 LISTS */
 
/* CP/M BDOS SYSTEM CALLS AND I/O ROUTINES */
list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9]
BDOS: PROCEDURE( FN, ARG ); DECLARE FN BYTE, ARG ADDRESS; GOTO 5; END;
PR$CHAR: PROCEDURE( C ); DECLARE C BYTE; CALL BDOS( 2, C ); END;
PR$STRING: PROCEDURE( S ); DECLARE S ADDRESS; CALL BDOS( 9, S ); END;
PR$NL: PROCEDURE; CALL PR$STRING( .( 0DH, 0AH, '$' ) ); END;
 
TO$STRING: PROCEDURE( N, S ); /* CONVERTS N TO A STRING AT S */
DECLARE ( N, S ) ADDRESS;
DECLARE V ADDRESS, N$STR ( 6 )BYTE, W BYTE;
DECLARE S$POS BYTE, S$STR BASED S ( 6 )BYTE;
V = N;
W = LAST( N$STR );
N$STR( W ) = '$';
N$STR( W := W - 1 ) = '0' + ( V MOD 10 );
DO WHILE( ( V := V / 10 ) > 0 );
N$STR( W := W - 1 ) = '0' + ( V MOD 10 );
END;
S$POS = 0;
DO W = W TO LAST( N$STR );
S$STR( S$POS ) = N$STR( W );
S$POS = S$POS + 1;
END;
END TO$STRING;
STR$LENGTH: PROCEDURE( S )ADDRESS; /* RETURNS THE LENGTH OF S */
DECLARE S ADDRESS;
DECLARE LEN ADDRESS, S$PTR ADDRESS, S$CH BASED S$PTR BYTE;
S$PTR = S;
LEN = 0;
DO WHILE S$CH <> '$';
LEN = LEN + 1;
S$PTR = S$PTR + 1;
END;
RETURN LEN;
END STR$LENGTH;
 
DECLARE LIST1 DATA( 1, 2, 3, 4, 5, 6, 7, 8, 9 ) /* THREE LISTS */
, LIST2 DATA( 10, 11, 12, 13, 14, 15, 16, 17, 18 ) /* OF BYTE */
, LIST3 DATA( 19, 20, 21, 22, 23, 24, 25, 26, 27 ) /* VALUES */
;
 
DECLARE RESULT ( 11 )ADDRESS; /* WILL HOLD THE CONCATENATED STRINGS */
 
DECLARE TEXT$BUFFER ( 256 )BYTE; /* WILL HOLD THE TEXT OF THE STRINGS */
DECLARE TEXT$PTR ADDRESS;
TEXT$PTR = .TEXT$BUFFER;
 
DECLARE I BYTE;
DO I = 0 TO LAST( LIST1 );
RESULT( I ) = TEXT$PTR;
CALL TO$STRING( LIST1( I ), TEXT$PTR );
TEXT$PTR = TEXT$PTR + STR$LENGTH( TEXT$PTR );
CALL TO$STRING( LIST2( I ), TEXT$PTR );
TEXT$PTR = TEXT$PTR + STR$LENGTH( TEXT$PTR );
CALL TO$STRING( LIST3( I ), TEXT$PTR );
TEXT$PTR = TEXT$PTR + STR$LENGTH( TEXT$PTR ) + 1; /* KEEP THE FINAL $ */
END;
CALL PR$CHAR( '(' );
DO I = 0 TO LAST( LIST1 );
CALL PR$CHAR( ' ' );
CALL PR$STRING( RESULT( I ) );
END;
CALL PR$STRING( .' )$' );
CALL PR$NL;
 
EOF
 
</syntaxhighlight>
{{out}}
<pre>
( 11019 21120 31221 41322 51423 61524 71625 81726 91827 )
</pre>
 
=={{header|Python}}==
<syntaxhighlight lang="python">list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9]
list2 = [10, 11, 12, 13, 14, 15, 16, 17, 18]
list3 = [19, 20, 21, 22, 23, 24, 25, 26, 27]
 
print(list([
reduce''.join(lambda x, y: x + y, [str(n) for n in z]) for z
in zip(list1, list2, list3)
])</syntaxhighlight>
))</lang>
 
 
which is also expressible as a map:
<syntaxhighlight lang="python">print(list(map(
lambda x, y, z: f'{x}{y}{z}',
[1, 2, 3, 4, 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14, 15, 16, 17, 18],
[19, 20, 21, 22, 23, 24, 25, 26, 27]
)))</syntaxhighlight>
{{out}}
<pre>['11019', '21120', '31221', '41322', '51423', '61524', '71625', '81726', '91827']</pre>
 
=={{header|RakuQuackery}}==
 
Not really seeing why we need to show the result twice but that's what the requirement is... ¯\_(ツ)_/¯ (I find myself making that gesture often in response to Calmosofts tasks.)
<syntaxhighlight lang="Quackery"> [ [] swap witheach
[ number$ nested join ] ] is [number$] ( [ --> [ )
 
[ swap witheach
[ over i^ peek
join swap
i^ poke ] ] is zip ( [ [ --> [ )
 
' [ 1 2 3 4 5 6 7 8 9 ]
' [ 10 11 12 13 14 15 16 17 18 ]
' [ 19 20 21 22 23 24 25 26 27 ]
3 times [ rot [number$] ]
zip zip
witheach [ echo$ sp ]</syntaxhighlight>
 
<lang perl6>say [[Z~] [1,2,3,4,5,6,7,8,9], [10,11,12,13,14,15,16,17,18], [19,20,21,22,23,24,25,26,27]] xx 2;</lang>
{{out}}
 
<pre>([11019 21120 31221 41322 51423 61524 71625 81726 91827] [11019 21120 31221 41322 51423 61524 71625 81726 91827])</pre>
<pre>11019 21120 31221 41322 51423 61524 71625 81726 91827</pre>
 
=={{header|Raku}}==
Various manipulations.
<syntaxhighlight lang="raku" line>my @lists = 1..9, 10..18, 19..27;
put [Z~] @lists; # the task
put [Z~] @lists».flip; # each component reversed
put [RZ~] @lists; # in reversed order
put ([Z~] @lists)».flip; # reversed components in reverse order</syntaxhighlight>
{{out}}
<pre>11019 21120 31221 41322 51423 61524 71625 81726 91827
10191 21102 32112 43122 54132 65142 76152 87162 98172
19101 20112 21123 22134 23145 24156 25167 26178 27189
91011 02112 12213 22314 32415 42516 52617 62718 72819</pre>
 
=={{header|Ring}}==
<langsyntaxhighlight lang="ring">
load "stdlib.ring"
list1 = [1,2,3,4,5,6,7,8,9]
Line 225 ⟶ 868:
txt = txt + "]"
see txt
</syntaxhighlight>
</lang>
{{out}}
<pre>
list = [11019,21120,31221,41322,51423,61524,71625,81726,91827][11019,21120,31221,41322,51423,61524,71625,81726,91827]
</pre>
 
=={{header|RPL}}==
Using the basic instruction set:
≪ 3 →LIST → lists
≪ { } 1 lists 1 GET SIZE '''FOR''' j
"" 1 3 '''FOR''' k lists k GET j GET →STR + '''NEXT''' STR→ + '''NEXT'''
≫ ≫ '<span style="color:blue">TASK</span>' STO
Using the extended instruction set introduced in 2003:
{{works with|HP|49}}
≪ 3 ≪ →STR + + STR→ ≫ DOLIST
≫ '<span style="color:blue">TASK</span>' STO
'''Input:'''
{ 1 2 3 4 5 6 7 8 9 } { 10 11 12 13 14 15 16 17 18 } { 19 20 21 22 23 24 25 26 27 } <span style="color:blue">TASK</span>
{{out}}
<pre>
1: { 11019 21120 31221 41322 51423 61524 71625 81726 91827 }
</pre>
 
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">list1 = (1..9) .to_a
list2 = (10..18).to_a
list3 = (19..27).to_a
 
p list = [list1, list2, list3].transpose.map{|trio| trio.join.to_i }</syntaxhighlight>
{{out}}
<pre>[11019, 21120, 31221, 41322, 51423, 61524, 71625, 81726, 91827]
</pre>
 
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">var lists = [
[1,2,3,4,5,6,7,8,9],
[10,11,12,13,14,15,16,17,18],
[19,20,21,22,23,24,25,26,27],
]
 
say lists.zip.map_2d {|*a| a.join.to_i }</syntaxhighlight>
 
{{out}}
<pre>
[11019, 21120, 31221, 41322, 51423, 61524, 71625, 81726, 91827]
</pre>
 
=={{header|V (Vlang)}}==
{{trans|go}}
<syntaxhighlight lang="v (vlang)">fn main() {
list1 := [1, 2, 3, 4, 5, 6, 7, 8, 9]!
list2 := [10, 11, 12, 13, 14, 15, 16, 17, 18]!
list3 := [19, 20, 21, 22, 23, 24, 25, 26, 27]!
mut list := [9]int{}
for i in 0..9 {
list[i] = list1[i]*int(1e4) + list2[i]*int(1e2) + list3[i]
}
println(list)
}</syntaxhighlight>
{{out}}
<pre>[11019, 21120, 31221, 41322, 51423, 61524, 71625, 81726, 91827]</pre>
 
=={{header|Wren}}==
<langsyntaxhighlight ecmascriptlang="wren">var list1 = (1..9).toList
var list2 = (10..18).toList
var list3 = (19..27).toList
var list = (0..8).map { |i| 1e4*list1[i] + 100*list2[i] + list3[i] }.toList
System.print(list)</langsyntaxhighlight>
 
{{out}}
Line 244 ⟶ 943:
 
=={{header|XPL0}}==
<langsyntaxhighlight XPL0lang="xpl0">intI;forI:=1to9do[IntOut(0,I*10000+(I+9)*100+I+18);ChOut(0,^ )]</langsyntaxhighlight>
{{out}}
<pre>
38

edits