Memoize edit distance

Memoized edit distance. Added editDistances function.