Skip to content

Instantly share code, notes, and snippets.

@DrunkenAlcoholic
Created May 14, 2024 03:53
Show Gist options
  • Save DrunkenAlcoholic/04472aa53b59f04de2cb633042bd479f to your computer and use it in GitHub Desktop.
Save DrunkenAlcoholic/04472aa53b59f04de2cb633042bd479f to your computer and use it in GitHub Desktop.
Hamming [Exercism - Nim]
proc distance*(a, b: string): int =
if a.len != b.len:
raise (ref ValueError)(msg: "out of bounds")
else:
for i in low(a)..high(a):
if a[i] != b[i]: inc(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment