June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,32 +1,29 @@
void
order(integer m, ...)
order(list a, list b)
{
integer i, j;
integer j;
record r;
text s;
ocall(o_, 0, 1, m, " ");
a.ucall(o_, 0, " ");
o_("| ");
i = (j = m) + 1;
while (i < count()) {
r[s = $i] += 1;
for (, s in b) {
r[s] += 1;
o_(s, " ");
i += 1;
}
o_("->");
i = 0;
do {
i += 1;
if ((r[s = $i] += -1) < 0) {
j = -1;
for (, s in a) {
if ((r[s] -= 1) < 0) {
o_(" ", s);
} else {
o_(" ", $(j += 1));
o_(" ", b[j += 1]);
}
} while (i < m);
}
o_newline();
}
@ -34,13 +31,13 @@ order(integer m, ...)
integer
main(void)
{
order(6, "the", "cat", "sat", "on", "the", "mat", "mat", "cat");
order(6, "the", "cat", "sat", "on", "the", "mat", "cat", "mat");
order(9, "A", "B", "C", "A", "B", "C", "A", "B", "C", "C", "A", "C", "A");
order(9, "A", "B", "C", "A", "B", "D", "A", "B", "E", "E", "A", "D", "A");
order(2, "A", "B", "B");
order(2, "A", "B", "B", "A");
order(4, "A", "B", "B", "A", "B", "A");
order(list("the", "cat", "sat", "on", "the", "mat"), list("mat", "cat"));
order(list("the", "cat", "sat", "on", "the", "mat"), list("cat", "mat"));
order(list("A", "B", "C", "A", "B", "C", "A", "B", "C"), list("C", "A", "C", "A"));
order(list("A", "B", "C", "A", "B", "D", "A", "B", "E"), list("E", "A", "D", "A"));
order(list("A", "B"), list("B"));
order(list("A", "B"), list("B", "A"));
order(list("A", "B", "B", "A"), list("B", "A"));
return 0;
}