Hacker News new | ask | show | jobs
by ttttannebaum 5296 days ago
Looking at your Python script. Might want to learn about the built-in set() functionality. For exmaple:

def uniqueletters(s): return set(c for c in s)

def intersect(word, charlist): return len(uniqueletters(word).intersection(charlist))

1 comments

In fact:

max(wordlist, key=(lambda w: intersect(w, charlist))

should replace a good portion of the create_mnemonic function. But now I'm just showing off. Just letting you know that Python is much cooler than you know.

Haskell, however, could probably do this in a few lines.

I've got a pull request sitting on GitHub showing me exactly this. Awesome! I'm about eight months into Python but my knowledge isn't particularly deep.