This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -0,0 +1,25 @@
integer i, l;
record r;
real h, x;
text s;
s = argv(1);
l = length(s);
i = l;
while (i) {
i -= 1;
rn_a_integer(r, cut(s, i, 1), 1);
}
h = 0;
if (r_first(r, s)) {
do {
x = r_q_integer(r, s);
x /= l;
h -= x * log2(x);
} while (r_greater(r, s, s));
}
o_real(6, h);
o_newline();