import std/editdistance var moduleNamespace = "pangocairo" var h1 = ["libpango-1.0.so.0", "libpangocairo-1.0.so.0", "libpangoft2-1.0.so.0"] for el in h1: echo editDistanceAscii(el, moduleNamespace), " ", el, " ", moduleNamespace Run $ nim c -r t.nim Hint: /tmp/hhh/t [Exec] 11 libpango-1.0.so.0 pangocairo 12 libpangocairo-1.0.so.0 pangocairo 14 libpangoft2-1.0.so.0 pangocairo Run
Goal was to pick the middle of the two strings -- obviously not a clever idea. But I still wonder why the distance is only 11 for the first string but 12 for the middle? If you wonder why we need that, the issue was discussed in <https://discourse.gnome.org/t/title-in-text-due-to-discourse-bug/4477>