Skip to content

Instantly share code, notes, and snippets.

@jkdeveyra
Created November 7, 2012 10:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jkdeveyra/4030815 to your computer and use it in GitHub Desktop.
Save jkdeveyra/4030815 to your computer and use it in GitHub Desktop.
def sentenceAnagrams(sentence: Sentence): List[Sentence] = {
def subSentence(occ: Occurrences): List[Sentence] = {
if (occ.isEmpty) List(List())
else
for {
x <- combinations(occ)
y <- dictionaryByOccurrences(x)
z <- subSentence(subtract(occ, x))
} yield y :: z
}
subSentence(sentenceOccurrences(sentence))
}
@Spike2050
Copy link

If I would have had a million guesses I wouldn't have found that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment