Created
January 9, 2015 14:26
-
-
Save defHLT/2feea6855b17e10b9914 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/clojure | |
; Created: Fri Jan 9 16:10:56 EET 2015 | |
; encoding: utf-8 | |
(defn burrows-wheeler [s] | |
(let [size (count s)] | |
(->> | |
(repeat size s) | |
(apply str) | |
(partition size 1) | |
(take size) | |
vec | |
(sort-by #(str (first %1))) | |
(map last) | |
(apply str)))) | |
(prn | |
(burrows-wheeler "banana")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment