Entropy: Difference between revisions
Content added Content deleted
m (→version 2: added/changed whitespace.) |
(Update to make the program compile with Nim 1.4: added missing type to parameter.) |
||
Line 1,661: | Line 1,661: | ||
<lang nim>import tables, math |
<lang nim>import tables, math |
||
proc entropy(s): float = |
proc entropy(s: string): float = |
||
var t = initCountTable[char]() |
var t = initCountTable[char]() |
||
for c in s: t.inc(c) |
for c in s: t.inc(c) |