Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
7
Task/Entropy-Narcissist/Racket/entropy-narcissist.rkt
Normal file
7
Task/Entropy-Narcissist/Racket/entropy-narcissist.rkt
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#lang racket
|
||||
(require math)
|
||||
(define (log2 x) (/ (log x) (log 2)))
|
||||
(define ds (string->list (file->string "entropy.rkt")))
|
||||
(define n (length ds))
|
||||
(- (for/sum ([(d c) (in-hash (samples->hash ds))])
|
||||
(* (/ c n) (log2 (/ c n)))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue