rosetta code: also add entropy_narcissist
authorJean Privat <jean@pryen.org>
Fri, 10 Jul 2015 15:43:32 +0000 (11:43 -0400)
committerJean Privat <jean@pryen.org>
Fri, 10 Jul 2015 15:43:32 +0000 (11:43 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

examples/rosettacode/entropy_narcissist.nit [new file with mode: 0644]
tests/sav/entropy_narcissist.res [new file with mode: 0644]

diff --git a/examples/rosettacode/entropy_narcissist.nit b/examples/rosettacode/entropy_narcissist.nit
new file mode 100644 (file)
index 0000000..28b6212
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env nit
+#
+# This file is part of NIT ( http://www.nitlanguage.org ).
+# This program is public domain
+
+# Task: Entropy/Narcissist
+# SEE: <http://rosettacode.org/wiki/Entropy/Narcissist>
+module entropy_narcissist
+
+import counter
+
+# Should be run in the right directory
+print "entropy_narcissist.nit".to_path.read_all.chars.to_counter.entropy
diff --git a/tests/sav/entropy_narcissist.res b/tests/sav/entropy_narcissist.res
new file mode 100644 (file)
index 0000000..ba66466
--- /dev/null
@@ -0,0 +1 @@
+0.0