Feeling a little iffy on this function to calculate the mean edit distances of a list of words...

github.com/sts10/tidy/blob/mai

take 2 on this tricky "calculate mean edit distance of list of words"

github.com/sts10/tidy/blob/mea

Feel like there's a way to cut the time in half?

Follow

@schlink Yep. There is. More like this...
for i = 0..list.len() {
for j = 0 .. i - 1 {
let this_edit_distance = find_edit_distance(list[i], list[j]);

· · Web · 1 · 0 · 0

@schlink The trick is to make a table. The list of words on the X axis, the list of words on the Y axis. You know you don't need the diagonal in that table (comparing index i to index i). You also don't need anything past that diagonal because that'll be a double compare.

Sign in to participate in the conversation
TableToot: Chatter for Tabletop Gamers

Tabletop gaming chatter in a moderated space. An inclusive community we'd like to hang out in.