RosettaCodeData/Task/Order-two-numerical-lists/PL-I/order-two-numerical-lists.pli

23 lines
564 B
Text
Raw Permalink Normal View History

2015-02-20 00:35:01 -05:00
lists: procedure options (main); /* 8 June 2014 */
declare a(10) fixed initial (1, 2, 3, 4, 5, 8, 9, 10, 16, 17),
b(15) fixed initial (5, 6, 7, 8, 9, 10, 11, 12, 15, 16, 17, 18, 20, 22, 23);
put skip list (compare(a, b));
put skip list (compare(b, a));
put skip list (compare(a, a));
compare: procedure (a, b) returns (bit (1));
declare (a, b)(*) fixed;
declare (i, m, n) fixed binary;
m = hbound(a,1); n = hbound(b,1);
do i = 1 to min(m, n);
return (a(i) < b(i));
end;
return (m < n);
end compare;
end lists;