From 275b9b5bf44a60b55b1dbb2c0f2a0f1d6f028454 Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:31:10 +0000 Subject: [PATCH] [Sync Iteration] 8th/hamming/1 --- solutions/8th/hamming/1/hamming.8th | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 solutions/8th/hamming/1/hamming.8th diff --git a/solutions/8th/hamming/1/hamming.8th b/solutions/8th/hamming/1/hamming.8th new file mode 100644 index 0000000..8a4b386 --- /dev/null +++ b/solutions/8th/hamming/1/hamming.8th @@ -0,0 +1,18 @@ +: calculate \ n -- + dup + 3 pick swap 1 s:slice swap + 2 pick swap 1 s:slice s:cmp + 0 n:= if 0 else 1 then + n:abs + 3 roll n:+ -rot +; + +: distance \ s1 s2 -- n +s:2len n:= not if null 2nip +else + 0 -rot + dup s:len 1 n:- nip + ( calculate ) 0 rot loop + 2drop +then +;