# Minimum numbers of three lists

Minimum numbers of three lists is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Given three lists:

• Numbers1 = [5,45,23,21,67]
• Numbers2 = [43,22,78,46,38]
• Numbers3 = [9,98,12,98,53]

then:

1. Select the minimum of Numbers[n], Numbers2[n] and Numbers3[n], where n <= 5 (one based).
2. Add minimum to a new list (Numbers).

## 11l

Translation of: Python
```V numbers1 = [5, 45, 23, 21, 67]
V numbers2 = [43, 22, 78, 46, 38]
V numbers3 = [9, 98, 12, 98, 53]

V numbers = (0 .< numbers1.len).map(i -> min(:numbers1[i], :numbers2[i], :numbers3[i]))

print(numbers)```
Output:
```[5, 22, 12, 21, 38]
```

```with Ada.Text_Io; use Ada.Text_Io;

procedure Minimum_Three_Lists is

type Number_Array is array (Positive range 1 .. 5) of Integer;

Numbers_1 : constant Number_Array := (5,45,23,21,67);
Numbers_2 : constant Number_Array := (43,22,78,46,38);
Numbers_3 : constant Number_Array := (9,98,12,98,53);

Result : Number_Array;
begin
for A in Number_Array'Range loop
declare
R   : Integer renames Result    (A);
N_1 : Integer renames Numbers_1 (A);
N_2 : Integer renames Numbers_2 (A);
N_3 : Integer renames Numbers_3 (A);
begin
R := Integer'Min (N_1, Integer'Min (N_2, N_3));
end;
end loop;

for R of Result loop
Put (R'Image);
end loop;
New_Line;
end Minimum_Three_Lists;
```
Output:
` 5 22 12 21 38`

## ALGOL 68

Generallising a little...

Library: ALGOL 68-rows
```BEGIN # construct a list of the minimum values of some other lists #
# lists are represented by arrays in this sample #
PR read "rows.incl.a68" PR # row-related utilities #
# returns a list composed of the minimum values of the lists in lists #
#         the lists must all have te same bounds #
PROC min = ( []REF[]INT lists )[]INT:
IF   LWB lists > UPB lists
THEN # no lists #
[]INT()
ELIF INT l length = ( UPB lists[ LWB lists ] + 1 ) - LWB lists[ LWB lists ];
l length < 1
THEN # the lists are empty #
[]INT()
ELSE # have some elements in the lists #
[ 1 : l length ]INT result;
INT r pos  := 0;
FOR i FROM LWB lists[ LWB lists ] TO UPB lists[ LWB lists ] DO
INT l min := lists[ LWB lists ][ i ];
FOR j FROM LWB lists + 1 TO UPB lists DO
IF l min > lists[ j ][ i ] THEN l min := lists[ j ][ i ] FI
OD;
result[ r pos +:= 1 ] := l min
OD;
result
FI # min # ;

# construct the lists of numbers required by the task #
REF[]INT numbers1 = HEAP[ 1 : 5 ]INT := (  5, 45, 23, 21, 67 );
REF[]INT numbers2 = HEAP[ 1 : 5 ]INT := ( 43, 22, 78, 46, 38 );
REF[]INT numbers3 = HEAP[ 1 : 5 ]INT := (  9, 98, 12, 98, 53 );
# display the minimum values for each element in the lists #
SHOW min( ( numbers1, numbers2, numbers3 ) )
END```
Output:
``` 5 22 12 21 38
```

## ALGOL W

```begin % show the minimum elements of three lists %
integer array numbers1, numbers2, numbers3 ( 1 :: 5 );
integer pos;
pos := 1; for v :=  5, 45, 23, 21, 67 do begin numbers1( pos ) := v; pos := pos + 1 end;
pos := 1; for v := 43, 22, 78, 46, 38 do begin numbers2( pos ) := v; pos := pos + 1 end;
pos := 1; for v :=  9, 98, 12, 98, 53 do begin numbers3( pos ) := v; pos := pos + 1 end;
for i := 1 until 5 do begin
integer m;
m := numbers1( i );
if numbers2( i ) < m then m := numbers2( i );
if numbers3( i ) < m then m := numbers3( i );
writeon( i_w := 1, s_w := 0, " ", m )
end for_i;
end.```
Output:
``` 5 22 12 21 38
```

## Arturo

```lists: [
[ 5 45 23 21 67]
[43 22 78 46 38]
[ 9 98 12 98 53]
]

print map 0..dec size first lists 'i ->
min map lists 'l -> l\[i]
```
Output:
`5 22 12 21 38`

## AutoHotkey

```Numbers1 := [5,45,23,21,67]
Numbers2 := [43,22,78,46,38]
Numbers3 := [9,98,12,98,53]
Numbers := []
for i, v in Numbers1
{
tempArr := []
loop 3
tempArr.Push(Numbers%A_Index%[i])
Numbers.Push(Min(tempArr*))
}

for i, v in Numbers
result .= v ", "
MsgBox % result := "[" . Trim(result, ", ") . "]"
```
Output:
`[5, 22, 12, 21, 38]`

## AWK

```# syntax: GAWK -f MINIMUM_NUMBERS_OF_THREE_LISTS.AWK
BEGIN {
n1 = split("5,45,23,21,67",numbers1,",")
n2 = split("43,22,78,46,38",numbers2,",")
n3 = split("9,98,12,98,53",numbers3,",")
if (n1 != n2 || n1 != n3) {
print("error: arrays must be same length")
exit(1)
}
for (i=1; i<=n1; i++) {
numbers[i] = min(min(numbers1[i],numbers2[i]),numbers3[i])
printf("%d ",numbers[i])
}
printf("\n")
exit(0)
}
function min(x,y) { return((x < y) ? x : y) }
```
Output:
```5 22 12 21 38
```

## BASIC

### Applesoft BASIC

Works with: Chipmunk Basic
```100 DIM n1(5)
110 n1(1) = 5 : n1(2) = 45 : n1(3) = 23 : n1(4) = 21 : n1(5) = 67
120 DIM n2(5)
130 n2(1) = 43 : n2(2) = 22 : n2(3) = 78 : n2(4) = 46 : n2(5) = 38
140 DIM n3(5)
150 n3(1) = 9 : n3(2) = 98 : n3(3) = 12 : n3(4) = 98 : n3(5) = 53
160 FOR i = 1 TO 5
170   LET a = n2(i)
180   LET b = n3(i)
190   GOSUB 260
200   LET a = n1(i)
210   LET b = m
220   GOSUB 260
230   PRINT m
240 NEXT i
250 END
260 rem FUNCTION min(a, b)
270   IF a < b THEN LET m = a
280   IF a >= b THEN LET m = b
290 RETURN
```
Output:
```5
22
12
21
38```

### BASIC256

```dim numbers1 = {5, 45, 23, 21, 67}
dim numbers2 = {43, 22, 78, 46, 38}
dim numbers3 = {9, 98, 12, 98, 53}

for i = 0 to 4
print min(numbers1[i], min(numbers2[i], numbers3[i]))
next i
end

function min(a, b)
if a < b then return a else return b
end function```
Output:
```5
22
12
21
38```

### Chipmunk Basic

Works with: Chipmunk Basic version 3.6.4
```100 dim n1(5)
110 n1(1) = 5 : n1(2) = 45 : n1(3) = 23 : n1(4) = 21 : n1(5) = 67
120 dim n2(5)
130 n2(1) = 43 : n2(2) = 22 : n2(3) = 78 : n2(4) = 46 : n2(5) = 38
140 dim n3(5)
150 n3(1) = 9 : n3(2) = 98 : n3(3) = 12 : n3(4) = 98 : n3(5) = 53
160 for i = 1 to 5
170   print min(n1(i),min(n2(i),n3(i)))
180 next i
190 end
200 sub min(a,b)
210   if a < b then min = a else min = b
220 end sub
```
Output:
```5
22
12
21
38```

### GW-BASIC

Works with: PC-BASIC version any
Works with: MSX BASIC version any
```100 DIM N1
110 N1(1) = 5
120 N1(2) = 45
130 N1(3) = 23
140 N1(4) = 21
150 N1(5) = 67
160 DIM N2
170 N2(1) = 43
180 N2(2) = 22
190 N2(3) = 78
200 N2(4) = 46
210 N2(5) = 38
220 DIM N3
230 N3(1) = 9
240 N3(2) = 98
250 N3(3) = 12
260 N3(4) = 98
270 N3(5) = 53
280 FOR I = 1 TO 5
290   A = N2(I)
300   B = N3(I)
310   GOSUB 380
320   A = N1(I)
330   B = M
340   GOSUB 380
350   PRINT M
360 NEXT I
370 END
380 REM FUNCTION min(a, b)
390   IF A < B THEN M = A ELSE M = B
400 RETURN
```
Output:
```5
22
12
21
38```

### Minimal BASIC

```100 DIM X(5)
110 LET X(1) = 5
120 LET X(2) = 45
130 LET X(3) = 23
140 LET X(4) = 21
150 LET X(5) = 67
160 DIM Y(5)
170 LET Y(1) = 43
180 LET Y(2) = 22
190 LET Y(3) = 78
200 LET Y(4) = 46
210 LET Y(5) = 38
220 DIM Z(5)
230 LET Z(1) = 9
240 LET Z(2) = 98
250 LET Z(3) = 12
260 LET Z(4) = 98
270 LET Z(5) = 53
280 FOR I = 1 TO 5
290  LET A = Y(I)
300  LET B = Z(I)
310  GOSUB 380
320  LET A = X(I)
330  LET B = M
340  GOSUB 380
350  PRINT M
360 NEXT I
370 STOP
380 REM FUNCTION MIN(A, B)
390  IF A < B THEN 420
410  LET M = B
415  RETURN
420  LET M = A
430 RETURN
440 END
```
Output:
```5
22
12
21
38```

### MSX Basic

Works with: MSX BASIC version any

The GW-BASIC solution works without any changes.

### PureBasic

```OpenConsole()

Procedure.i min(a, b)
If a < b
Result = a
Else
Result = b
EndIf
ProcedureReturn result
EndProcedure

Dim n1.i(5)
n1(1) =  5 : n1(2) = 45 : n1(3) = 23 : n1(4) = 21 : n1(5) = 67
Dim n2.i(5)
n2(1) = 43 : n2(2) = 22 : n2(3) = 78 : n2(4) = 46 : n2(5) = 38
Dim n3.i(5)
n3(1) =  9 : n3(2) = 98 : n3(3) = 12 : n3(4) = 98 : n3(5) = 53

For i.i = 1 To 5
PrintN(Str(min(n1(i), min(n2(i), n3(i)))))
Next i

PrintN(#CRLF\$ + "--- Press ENTER to exit ---"): Input()
CloseConsole()```
Output:
```5
22
12
21
38```

### QBasic

Works with: QBasic version 1.1
Works with: QuickBasic version 4.5
```FUNCTION min (a, b)
IF a < b THEN min = a ELSE min = b
END FUNCTION

DIM numbers(1 To 3, 1 To 5) = {{5,45,23,21,67},{43,22,78,46,38},{9,98,12,98,53}}

FOR i = 1 TO 5
PRINT min(numbers(1, i), min(numbers(2, i), numbers(3, i)))
NEXT i
END
```
Output:
```5
22
12
21
38```

### Quite BASIC

```100 ARRAY n1
110 LET n1(1) = 5
120 LET n1(2) = 45
130 LET n1(3) = 23
140 LET n1(4) = 21
150 LET n1(5) = 67
160 ARRAY n2
170 LET n2(1) = 43
180 LET n2(2) = 22
190 LET n2(3) = 78
200 LET n2(4) = 46
210 LET n2(5) = 38
220 ARRAY n3
230 LET n3(1) = 9
240 LET n3(2) = 98
250 LET n3(3) = 12
260 LET n3(4) = 98
270 LET n3(5) = 53
280 FOR i = 1 TO 5
290   LET a = n2(i)
300   LET b = n3(i)
310   GOSUB 380
320   LET a = n1(i)
330   LET b = m
340   GOSUB 380
350   PRINT m
360 NEXT i
370 END
380 rem FUNCTION min(a, b)
390   IF a < b THEN LET m = a
400   IF a >= b THEN LET m = b
410 RETURN
```
Output:
```5
22
12
21
38```

### Run BASIC

Works with: Just BASIC
Works with: Liberty BASIC

The Yabasic solution works without any changes.

### True BASIC

```FUNCTION min(a, b)
IF a < b then LET min = a else LET min = b
END FUNCTION

DIM n1(5)
LET n1(1) =  5
LET n1(2) = 45
LET n1(3) = 23
LET n1(4) = 21
LET n1(5) = 67
DIM n2(5)
LET n2(1) = 43
LET n2(2) = 22
LET n2(3) = 78
LET n2(4) = 46
LET n2(5) = 38
DIM n3(5)
LET n3(1) =  9
LET n3(2) = 98
LET n3(3) = 12
LET n3(4) = 98
LET n3(5) = 53

FOR i = 1 to 5
PRINT min(n1(i), min(n2(i), n3(i)))
NEXT i
END
```
Output:
```5
22
12
21
38```

### XBasic

Works with: Windows XBasic
```PROGRAM	"Minimum numbers of three lists"
VERSION	"0.0000"

DECLARE FUNCTION  Entry ()
DECLARE FUNCTION  min(a, b)

FUNCTION  Entry ()
DIM n1[5]
n1[1] =  5:  n1[2] = 45 : n1[3] = 23 : n1[4] = 21 : n1[5] = 67
DIM n2[5]
n2[1] = 43 : n2[2] = 22 : n2[3] = 78 : n2[4] = 46 : n2[5] = 38
DIM n3[5]
n3[1] =  9 : n3[2] = 98 : n3[3] = 12 : n3[4] = 98 : n3[5] = 53

FOR i = 1 TO 5
PRINT min(n1[i], min(n2[i], n3[i]))
NEXT i
END FUNCTION

FUNCTION min (a, b)
IF a < b THEN RETURN a ELSE RETURN b
END FUNCTION
END PROGRAM
```
Output:
```5
22
12
21
38```

### Yabasic

#### With one-dimensional arrays

Works with: Run BASIC
Works with: Just BASIC
Works with: Liberty BASIC
```dim n1(5)
n1(1) =  5 : n1(2) = 45 : n1(3) = 23 : n1(4) = 21 : n1(5) = 67
dim n2(5)
n2(1) = 43 : n2(2) = 22 : n2(3) = 78 : n2(4) = 46 : n2(5) = 38
dim n3(5)
n3(1) =  9 : n3(2) = 98 : n3(3) = 12 : n3(4) = 98 : n3(5) = 53

for i = 1 to 5
print min(n1(i), min(n2(i), n3(i)))
next i
end```
Output:
```5
22
12
21
38```

#### With multidimensional arrays

```dim n(3, 5)
n(1, 1) =  5 : n(1, 2) = 45 : n(1, 3) = 23 : n(1, 4) = 21 : n(1, 5) = 67
n(2, 1) = 43 : n(2, 2) = 22 : n(2, 3) = 78 : n(2, 4) = 46 : n(2, 5) = 38
n(3, 1) =  9 : n(3, 2) = 98 : n(3, 3) = 12 : n(3, 4) = 98 : n(3, 5) = 53

for i = 1 to 5
print min(n(1, i), min(n(2, i), n(3, i)))
next i
end```
Output:
```5
22
12
21
38```

## C

```#include <stdio.h>

int min(int a, int b) {
if (a < b) return a;
return b;
}

int main() {
int n;
int numbers1[5] = {5, 45, 23, 21, 67};
int numbers2[5] = {43, 22, 78, 46, 38};
int numbers3[5] = {9, 98, 12, 98, 53};
int numbers[5]  = {};
for (n = 0; n < 5; ++n) {
numbers[n] = min(min(numbers1[n], numbers2[n]), numbers3[n]);
printf("%d ", numbers[n]);
}
printf("\n");
return 0;
}
```
Output:
```5 22 12 21 38
```

## Delphi

Works with: Delphi version 6.0

```type TNumList =  array [0..2, 0..4] of integer;

const NumLists: TNumList = (
(5,45,23,21,67),
(43,22,78,46,38),
(9,98,12,98,53));

type TIntArray = array of integer;

procedure GetMinimumCols(NumList: TNumList; var ColMins: TIntArray);
{Get the minimum value is each colum and store in array}
var X,Y: integer;
var Low: integer;
begin
for X:=0 to High(NumLists[0]) do
begin
Low:=High(Integer);
for Y:=0 to High(NumList) do
if NumLists[Y,X]<Low then Low:=NumList[Y,X];
SetLength(ColMins,Length(Colmins)+1);
ColMins[High(ColMins)]:=Low;
end;
end;

procedure ShowColumnMins(Memo: TMemo);
{Show min value for columns in NumLists}
var ColMins: TIntArray;
var I: integer;
var S: string;
begin
GetMinimumCols(NumLists,ColMins);
S:='[';
for I:=0 to High(ColMins) do
begin
if I<>0 then S:=S+' ';
S:=S+IntToStr(ColMins[I]);
end;
S:=S+']';
end;
```
Output:
```[5 22 12 21 38]

```

## F#

```// Minimum numbers of three lists. Nigel Galloway: October 26th., 2021
let N1,N2,N3=[5;45;23;21;67],[43;22;78;46;38],[9;98;12;98;53]
printfn "%A" (List.zip3 N1 N2 N3|>List.map(fun(n,g,l)->min (min n g) l))
```
Output:
```[5; 22; 12; 21; 38]
```

## Factor

Works with: Factor version 0.99 2021-06-02
```USING: math.order sequences prettyprint ;

{ 5 45 23 21 67 } { 43 22 78 46 38 } { 9 98 12 98 53 }
[ min min ] 3map .
```
Output:
```{ 5 22 12 21 38 }
```

## Fermat

```[numbers1] := [(5,45,23,21,67)];
[numbers2] := [(43,22,78,46,38)];
[numbers3] := [(9,98,12,98,53)];

Func Minby( a, b, c, n ) =
if a[n]<b[n] and a[n]<b[n] then Return(a[n]) fi;
if b[n]<c[n] then Return(b[n]) fi;
Return(c[n]).;

for i = 1 to 5 do !!Minby( [numbers1], [numbers2], [numbers3], i ) od;```
Output:
```
5
22
23
21
38

```

## FreeBASIC

```#define min(a, b) Iif(a<b,a,b)

dim as integer numbers(1 to 3, 1 to 5) = _
{ {5,45,23,21,67}, {43,22,78,46,38}, {9,98,12,98,53} }

for i as uinteger = 1 to 5
print min( numbers(1, i), min(numbers(2,i), numbers(3, i) ) )
next i```
Output:
```
5
22
12
21
38

```

## Go

Library: Go-rcu
```package main

import (
"fmt"
"rcu"
)

func main() {
numbers1 := [5]int{5, 45, 23, 21, 67}
numbers2 := [5]int{43, 22, 78, 46, 38}
numbers3 := [5]int{9, 98, 12, 98, 53}
numbers := [5]int{}
for n := 0; n < 5; n++ {
numbers[n] = rcu.Min(rcu.Min(numbers1[n], numbers2[n]), numbers3[n])
}
fmt.Println(numbers)
}
```
Output:
```[5 22 12 21 38]
```

```import Data.List (transpose)

numbers1, numbers2, numbers3 :: [Integer]
numbers1 = [5, 45, 23, 21, 67]
numbers2 = [43, 22, 78, 46, 38]
numbers3 = [9, 98, 12, 98, 53]

main :: IO ()
main =
print \$
minimum
<\$> transpose
[numbers1, numbers2, numbers3]
```
Output:
`[5,22,12,21,38]`

## J

```   ] numbers =. 3 5 \$ 5 45 23 21 67 43 22 78 46 38 9 98 12 54 53
5 45 23 21 67
43 22 78 46 38
9 98 12 54 53

<./ numbers
5 22 12 21 38
```

## JavaScript

```(() => {
"use strict";

const main = () => {
const
numbers1 = [5, 45, 23, 21, 67],
numbers2 = [43, 22, 78, 46, 38],
numbers3 = [9, 98, 12, 98, 53];

return transpose([
numbers1, numbers2, numbers3
]).map(minimum);
};

// --------------------- GENERIC ---------------------

// min :: Ord a => (a, a) -> a
const min = (a, b) =>
// The lesser of a and b.
b < a ? b : a;

// minimum :: Ord a => [a] -> a
const minimum = xs =>
// The least value of xs.
0 < xs.length ? (
xs.slice(1).reduce(min, xs[0])
) : null;

// transpose :: [[a]] -> [[a]]
const transpose = rows =>
// The columns of the input transposed
// into new rows.
// Simpler version of transpose, assuming input
// rows of even length.
0 < rows.length ? rows[0].map(
(_, i) => rows.flatMap(
v => v[i]
)
) : [];

// MAIN ---
return JSON.stringify(main());
})();
```
Output:
`[5,22,12,21,38]`

## jq

Works with: jq

Works with gojq, the Go implementation of jq

Two solutions are presented - an iterative one that mirrors the problem description, and one that is functional:
```def numbers1: [ 5, 45, 23, 21, 67];
def numbers2: [43, 22, 78, 46, 38];
def numbers3: [ 9, 98, 12, 98, 53];```

Mirroring the requirements

```[range(0;5)
| [numbers1[.], numbers2[.], numbers3[.]] | min]```

Functional solution

```[numbers1, numbers2, numbers3]
| transpose
| map(min)```
Output:
```[5,22,12,21,38]
```

## Julia

Computed in the REPL, using matrix functions.

```julia> Numbers1 = [5,45,23,21,67]
5-element Vector{Int64}:
5
45
23
21
67

julia> Numbers2 = [43,22,78,46,38]
5-element Vector{Int64}:
43
22
78
46
38

julia> Numbers3 = [9,98,12,98,53]
5-element Vector{Int64}:
9
98
12
98
53

julia> mat = hcat(Numbers1, Numbers2, Numbers3)
5×3 Matrix{Int64}:
5  43   9
45  22  98
23  78  12
21  46  98
67  38  53

julia> minimum(mat, dims=2)
5×1 Matrix{Int64}:
5
22
12
21
38
```

## Mathematica / Wolfram Language

```Min /@ Transpose@{{5, 45, 23, 21, 67}, {43, 22, 78, 46, 38}, {9, 98,
12, 98, 53}}
```
Output:
```
{5,22,12,21,38}

```

## Nim

```const
Numbers1 = [ 5, 45, 23, 21, 67]
Numbers2 = [43, 22, 78, 46, 38]
Numbers3 = [ 9, 98, 12, 98, 53]

var numbers: array[0..Numbers1.high, int]

for i in 0..numbers.high:
numbers[i] = min(min(Numbers1[i], Numbers2[i]), Numbers3[i])

echo numbers
```
Output:
`[5, 22, 12, 21, 38]`

## ooRexx

```/* REXX */
l.1=.array~of( 5, 45, 23, 21, 67)
l.2=.array~of(43, 22, 78, 46, 38)
l.3=.array~of( 9, 98, 12, 98, 53)
o=''
Do i=1 To 5
o=o min(l.1[i],l.2[i],l.3[i])
End
Say strip(o)```
Output:
`[5 22 12 21 38]`

## Perl

```use strict;
use warnings;
use List::Util 'min';

my @lists = ([5,45,23,21,67], [43,22,78,46,38], [9,98,12,98,53]);

for my \$i (0 .. \$#{ \$lists[0] }) {
print ' ' . min map { \$lists[\$_][\$i] } 0..\$#lists;
}
```
Output:
` 5 22 12 21 38`

## Phix

```with javascript_semantics
constant N123 = {{ 5, 45, 23, 21, 67},
{43, 22, 78, 46, 38},
{ 9, 98, 12, 98, 53}}
printf(1,"%V\n",{apply(apply(true,vslice,{{N123},tagset(5)}),minsq)})
```
Output:
```{5,22,12,21,38}
```

## Plain English

```To run:
Start up.
Create a first list and a second list and a third list.
Find a minimum list (element-wise) of the first list and the second list and the third list.
Destroy the first list. Destroy the second list. Destroy the third list.
Write the minimum list on the console.
Destroy the minimum list.
Wait for the escape key.
Shut down.

An entry is a thing with a number.

A list is some entries.

To add a number to a list:
Allocate memory for an entry.
Put the number into the entry's number.
Append the entry to the list.

To create a first list and a second list and a third list:
Add 5 to the first list.
Add 45 to the first list.
Add 23 to the first list.
Add 21 to the first list.
Add 67 to the first list.
Add 43 to the second list.
Add 22 to the second list.
Add 78 to the second list.
Add 46 to the second list.
Add 38 to the second list.
Add 9 to the third list.
Add 98 to the third list.
Add 12 to the third list.
Add 98 to the third list.
Add 53 to the third list.

To find a minimum number of a number and another number:
If the number is less than the other number, put the number into the minimum; exit.
Put the other number into the minimum.

To find a minimum list (element-wise) of a list and another list and a third list:
Get an entry from the list.
Get another entry from the other list.
Get a third entry from the third list.
Loop.
If the entry is nil, exit.
Find a minimum number of the entry's number and the other entry's number.
Find another minimum number of the third entry's number and the minimum number.
Add the other minimum number to the minimum list.
Put the entry's next into the entry.
Put the other entry's next into the other entry.
Put the third entry's next into the third entry.
Repeat.

To write a list on a console;
To write a list to a console:
Get an entry from the list.
Loop.
If the entry is nil, write "" on the console; exit.
Convert the entry's number to a string.
Write the string on the console without advancing.
If the entry's next is not nil, write ", " on the console without advancing.
Put the entry's next into the entry.
Repeat.```
Output:
```5, 22, 12, 21, 38
```

## Python

```numbers1 = [5,45,23,21,67]
numbers2 = [43,22,78,46,38]
numbers3 = [9,98,12,98,53]

numbers = [min(numbers1[i],numbers2[i],numbers3[i]) for i in range(0,len(numbers1))]

print(numbers)
```
Output:
`[5, 22, 12, 21, 38]`

Or, in terms of zip:

```'''Minimum value in each column'''

numbers1 = [5, 45, 23, 21, 67]
numbers2 = [43, 22, 78, 46, 38]
numbers3 = [9, 98, 12, 98, 53]

print([
min(x) for x
in zip(*[numbers1, numbers2, numbers3])
])
```
Output:
`[5, 22, 12, 21, 38]`

## Quackery

`transpose` is defined at Matrix transposition#Quackery.

```  [ ' [  5 45 23 21 67 ] ] is Numbers1
[ ' [ 43 22 78 46 38 ] ] is Numbers2
[ ' [  9 98 12 98 53 ] ] is Numbers3

[]
Numbers1 nested
Numbers2 nested join
Numbers3 nested join
transpose
witheach
witheach min
join ]
echo```
Output:
`[ 5 22 12 21 38 ]`

## Raku

```say [Zmin] (5,45,23,21,67), (43,22,78,46,38), (9,98,12,98,53);
```
Output:
`(5 22 12 21 38)`

## Red

```Red [
Red-version: 0.6.4
Description: "Find the element-wise minimum of three lists"
]

numbers1: [5 45 23 21 67]
numbers2: [43 22 78 46 38]
numbers3: [9 98 12 98 53]
length: length? numbers1
result: append/dup [] 0 length
repeat i length [
result/:i: min min numbers1/:i numbers2/:i numbers3/:i
]
print result
```
Output:
```5 22 12 21 38
```

## REXX

```/* REXX */
w= 5 45 23 21 67 43 22 78 46 38 9 98 12 98 53
Do i=1 To 3
Do j=1 To 5
Parse Var w l.i.j w
End
End
o=''
Do j=1 To 5
o=o min(l.1.j,l.2.j,l.3.j)
End
Say strip(o)
```
Output:
`5 22 12 21 38`

## Ring

```see "? "working..."

Num1 = [ 5,45,23,21,67]
Num2 = [43,22,78,46,38]
Num3 = [ 9,98,12,98,53]
n = len(Num1)
Nums = list(n)

for i = 1 to n
Nums[i] = string(min([Num1[i], Num2[i], Num3[i]]))
next

? "The minimum numbers of three lists = " + fmtArray(Nums)
put "done..."

func fmtArray(ar)
rv = ar[1]
for n = 2 to len(ar) rv += "," + ar[n] next
return "[" + rv + "]"```
Output:
```working...
The minimum numbers of three lists = [5,22,12,21,38]
done...
```

## RPL

```≪ → l1 l2 l3
≪ {} 1 l1 SIZE l2 SIZE l3 SIZE MIN MIN FOR j
l1 j GET l2 j GET l3 j GET MIN MIN + NEXT
≫ ≫ ‘L3MIN’ STO
```
```{5 45 23 21 67} {43 22 78 46 38} {9 98 12 98 53} L3MIN
```
Output:
```1: { 5 22 12 21 38 }
```

## Ruby

```numbers1 = [ 5, 45, 23, 21, 67]
numbers2 = [43, 22, 78, 46, 38]
numbers3 = [ 9, 98, 12, 98, 53]

p [numbers1, numbers2, numbers3].transpose.map(&:min)
```
Output:
```[5, 22, 12, 21, 38]
```

## Sidef

```var lists = [
[ 5, 45, 23, 21, 67],
[43, 22, 78, 46, 38],
[ 9, 98, 12, 98, 53],
]

say lists.zip.map{.min}
```
Output:
```[5, 22, 12, 21, 38]
```

## V (Vlang)

```import math
fn main() {
numbers1 := [5, 45, 23, 21, 67]!
numbers2 := [43, 22, 78, 46, 38]!
numbers3 := [9, 98, 12, 98, 53]!
mut numbers := [5]int{}
for n in 0..5 {
numbers[n] = math.min<int>(math.min<int>(numbers1[n], numbers2[n]), numbers3[n])
}
println(numbers)
}```
Output:
`[5, 22, 12, 21, 38]`

## Wren

```var numbers1 = [ 5, 45, 23, 21, 67]
var numbers2 = [43, 22, 78, 46, 38]
var numbers3 = [ 9, 98, 12, 98, 53]
var numbers  = List.filled(5, 0)
for (n in 0..4) numbers[n] = numbers1[n].min(numbers2[n]).min(numbers3[n])
System.print(numbers)```
Output:
```[5, 22, 12, 21, 38]
```

## XPL0

```func Min(A, B);
int  A, B;
return if A<B then A else B;

int N1, N2, N3, I;
[N1:= [5,45,23,21,67];
N2:= [43,22,78,46,38];
N3:= [9,98,12,98,53];
for I:= 0 to 4 do
[IntOut(0, Min(Min(N1(I), N2(I)), Min(N2(I), N3(I))));
ChOut(0, ^ );
];
]```
Output:
```5 22 12 21 38
```