Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
8
Task/Entropy/Oforth/entropy.oforth
Normal file
8
Task/Entropy/Oforth/entropy.oforth
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
: entropy(s) -- f
|
||||
| freq sz |
|
||||
s size dup ifZero: [ return ] asFloat ->sz
|
||||
ListBuffer initValue(255, 0) ->freq
|
||||
s apply( #[ dup freq at 1+ freq put ] )
|
||||
0.0 freq applyIf( #[ 0 <> ], #[ sz / dup ln * - ] ) Ln2 / ;
|
||||
|
||||
entropy("1223334444") .
|
||||
Loading…
Add table
Add a link
Reference in a new issue