Minimal numbers of three lists at same position

From Rosetta Code
Minimal numbers of three lists at same position 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.
Task


Let gine three lists:
list1 = [9,18,27,2,65,43,78,11,2]
list2 = [2,27,36,1,14,89,25,9,15]
list3 = [1,45,78,5,11,95,14,25,9]
Let create minList which contain minimal number of three lists at same position.

Perl

<lang perl>#!/usr/bin/perl

use strict; use warnings; use List::Util qw( min );

my $list1 = [9,18,27,2,65,43,78,11,2]; my $list2 = [2,27,36,1,14,89,25,9,15]; my $list3 = [1,45,78,5,11,95,14,25,9];

my @minlist = map min($list1->[$_], $list2->[$_], $list3->[$_]), 0 .. $#$list1; use Data::Dump 'dd'; dd \@minlist;</lang>

Output:
[1, 18, 27, 1, 11, 43, 14, 9, 2]

Phix

Duplicate of Minimum_numbers_of_three_lists#Phix (except for different constants and 9 numbers in each list instead of 5)

Ring

<lang ring> see "working..." + nl

list1 = [9,18,27,2,65,43,78,11,2] list2 = [2,27,36,1,14,89,25,9,15] list3 = [1,45,78,5,11,95,14,25,9] list = [] minList = [] len = len(list1)

for n = 1 to len

   add(minList,list1[n])
   add(minList,list2[n])
   add(minList,list3[n])
   minList = sort(minList)
   min = minList[1]
   add(list,min)
   minList = []

next

showArray(list)

see nl + "done..." + nl

func showArray(array)

    txt = ""
    see "["
    for n = 1 to len(array)
        txt = txt + array[n] + ","
    next
    txt = left(txt,len(txt)-1)
    txt = txt + "]"
    see txt

</lang>

Output:
working...
[1,18,27,1,11,43,14,9,2]
done...