Anagrams Live Demo
First, you need to require anagrams into your namespace
(ns your-namespace
(:require [anagrams.core :as anagrams]
[english-words.core :as words]))
You should then set the world list that should be used to find anagrams. If you're on a nix machine, I would recommend pulling in the /usr/share/dict/words file
To find anagrams, call anagrams/anagrams-of
with a string. Try changing stop, to triangle, this is a live demo! Thanks KLIPSE!
(anagrams/anagrams-of "stop")
To append words to the dictionary, use anagrams/append-word-list!
with a newline separated list of new words
(anagrams/append-word-list! "The Best Things in Life are Free")
The library is happy to find anagrams of sentences as well
(anagrams/anagrams-of "Nail-biting refreshes the feet")
If no anagrams can be found, anagrams/anagrams-of
will return an empty set.
(anagrams/anagrams-of "No Anagrams of me :(")