Skip to content

Instantly share code, notes, and snippets.

@defHLT
Created January 9, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save defHLT/2feea6855b17e10b9914 to your computer and use it in GitHub Desktop.
Save defHLT/2feea6855b17e10b9914 to your computer and use it in GitHub Desktop.
#!/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