News for hackers. Stuff that matters.
Re:Can your programming language do this? by slava_pestov on Wednesday July 08, 2009 @07:41PM (#694911)
Here's a point-free version in Factor. It looks a bit different from the original formula but once you get used to it its very quick to read; I prefer it to the Lisp code since there are fewer parentheses to track:

    : entropy ( n -- e ) [1,b] [ p dup log * ] sigma neg ;
Note that [1,b] is a word which makes a numeric range from an integer on the stack, and [ ... ] is a function object (quotation).

There are no comments on this comment yet.