Method code for $list.columnize()

[Turn on line numbering]
arg list, cols, @rest;
var width, lines, line, separator, linelength, curcol;

// turn [...] into ".   .   ."
// rest[1]==separator; rest[2]==linelength
[(separator ?= "   "), (linelength ?= 78)] = rest;
width = linelength / cols - separator.length();
lines = [];
while (list) {
    line = list[1].pad(width);
    list = list.subrange(2);
    for curcol in [2 .. cols] {
        if (list) {
            line = line + separator + list[1].pad(width);
            list = list.subrange(2);
        }
    }
    lines += [line];
}
return lines;

["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark