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

@ -0,0 +1,48 @@
text
decode(list l)
{
integer c, e, i;
text al, s;
al = "abcdefghijklmnopqrstuvwxyz";
for (i, e in l) {
s = insert(s, -1, c = al[e]);
al = insert(delete(al, e), 0, c);
}
s;
}
list
encode(text s)
{
integer c, e;
text al;
list l;
al = "abcdefghijklmnopqrstuvwxyz";
while (c = initial(s)) {
s = delete(s, 0);
l.append(e = place(al, c));
al = insert(delete(al, e), 0, c);
}
l;
}
integer
main(void)
{
integer i;
text s;
for (i, s in list("broood", "bananaaa", "hiphophiphop")) {
list l;
l = encode(s);
l.ucall(o_, 1, " ");
o_(": ", decode(l), "\n");
}
0;
}