Thread overview | ||||||
---|---|---|---|---|---|---|
|
April 28, 2015 Fuzzy Levenshtein variant of std.conv.to | ||||
---|---|---|---|---|
| ||||
At https://github.com/nordlow/justd/blob/master/conv_ex.d I'm trying to figure out how to best implement a fuzzy variant of std.conv.to when converting a string to an enum. I'm almost there but I'm uncertain how to best pick the index of the smallest element in `distances` and then convert it to the corresponding enumerator for when `U` is an enum. Help please. |
April 28, 2015 Re: Fuzzy Levenshtein variant of std.conv.to | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Tuesday, 28 April 2015 at 16:20:24 UTC, Per Nordlöw wrote: I update my Github repo. I had forgotten to push my latest changes. |
April 29, 2015 Re: Fuzzy Levenshtein variant of std.conv.to | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Tuesday, 28 April 2015 at 23:09:27 UTC, Per Nordlöw wrote:
> On Tuesday, 28 April 2015 at 16:20:24 UTC, Per Nordlöw wrote:
>
> I update my Github repo. I had forgotten to push my latest changes.
I solved it.
|
April 30, 2015 Re: Fuzzy Levenshtein variant of std.conv.to | ||||
---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Wednesday, 29 April 2015 at 14:46:04 UTC, Per Nordlöw wrote: > On Tuesday, 28 April 2015 at 23:09:27 UTC, Per Nordlöw wrote: >> On Tuesday, 28 April 2015 at 16:20:24 UTC, Per Nordlöw wrote: >> >> I update my Github repo. I had forgotten to push my latest changes. > > I solved it. I started working on this yesterday before you solved it, and ended up finishing a solution. It was a fun excercise, thanks. https://gist.github.com/JakobOvrum/515737710619a9d97273 It uses a loop instead of a range composition because of the early return when the Levenshtein distance is 0; that would be clumsy to express with ranges. |
Copyright © 1999-2021 by the D Language Foundation