Skip to content

Instantly share code, notes, and snippets.

@mwmitchell
Created August 11, 2012 21:30
Show Gist options
  • Save mwmitchell/3327439 to your computer and use it in GitHub Desktop.
Save mwmitchell/3327439 to your computer and use it in GitHub Desktop.
;; [org.clojure/math.combinatorics "0.0.3"]
(ns wordhash
(:require [clojure.math.combinatorics :as comb]
[clojure.string :as string]))
(defn words->code [words n]
(apply str
(take n (keep identity
(map (fn [[x y]]
(when-let [v (get (get words y) x)]
(string/upper-case v)))
(comb/selections (range (count words)) 2))))))
(words->code ["George" "W" "Bush"] 6)
;; => "GWBEUO"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment