On 2020-01-31 09:44, mark via Digitalmars-d-learn wrote:
I can't use the levenshtien distance because although it is a better solution,
[...]
Nah, it isn't, sorry for the noise, should have slept before sending the message, was thinking of
hamming distance:
auto a = "abcd";
auto b = "bcda";
I forgot to mention: I know it isn't worth bothering with
const/immutable for this tiny example. But I want to learn how to
write large D programs, so I need to get into the right habits
and know the right things.
Thanks for your implementation.
I can't use the levenshtien distance because although it is a
better solution, I want to keep the implementation as compatible
with those in the other languages as possible.
Your main() is much shorter than mine, but doesn't match the
behaviour (and again I wa
From one noob to another: Not much of a difference, but levenshteinDistance seems to be a good fit
here. About as fast as your solution, slightly lower memory usage. byCodeUnit/byChar might shave off
a few more ms.
For small scripts like these I'm usually not even bothering with const correctne
Below is a program that produces a wordladder.
The algorithm is probably suboptimal, but I don't care since I've
implemented the same one in Python, Rust, Go, Java, and Nim, so I
find it useful for language comparison purposes.
What I'd like some feedback on is how to improve the code
(keepi