Jump to content

Entropy: Difference between revisions

343 bytes added ,  2 years ago
Added Arturo implementation
(Added Arturo implementation)
Line 241:
1.846439345
</pre>
 
=={{header|Arturo}}==
 
<lang rebol>entropy: function [s][
t: #[]
loop s 'c [
unless key? t c -> t\[c]: 0
t\[c]: t\[c] + 1
]
result: new 0
loop values t 'x ->
'result - (x//(size s)) * log x//(size s) 2
 
return result
]
 
print entropy "1223334444"</lang>
 
{{out}}
 
<pre>1.846439344671015</pre>
 
=={{header|AutoHotkey}}==
1,532

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.