authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-06-05 01:39:04 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-06-05 01:39:04 -07:00
loge5481b297b6023d446d835156591ba5ce88c17be
tree351a075a108db6b3e09fc0cf172a88f9a548d6c3
parente548b0bcc7b6f34f636c0b6b905928d31254c54d

remove nektro/zig-range


2 files changed, 3 insertions(+), 6 deletions(-)

src/lib.zig+3-4
......@@ -1,5 +1,4 @@
11const std = @import("std");
2const range = @import("range").range;
32
43// // the naïve recursive implementation
54// pub fn leven(comptime T: type, a: []const T, b: []const T) usize {
......@@ -53,17 +52,17 @@ pub fn leven(comptime T: type, alloc: std.mem.Allocator, a: []const T, b: []cons
5352 const array = try alloc.alloc(usize, ll);
5453 defer alloc.free(array);
5554
56 for (range(ll), 0..) |_, i| {
55 for (0..ll) |i| {
5756 charCodeCache[i] = left[start + i];
5857 array[i] = i + 1;
5958 }
6059
61 for (range(rl), 0..) |_, j| {
60 for (0..rl) |j| {
6261 const bCharCode = right[start + j];
6362 var temp = j;
6463 result = j + 1;
6564
66 for (range(ll), 0..) |_, i| {
65 for (0..ll) |i| {
6766 const temp2 = if (bCharCode == charCodeCache[i]) temp else temp + 1;
6867 temp = array[i];
6968 array[i] = if (temp > result) (if (temp2 > result) result + 1 else temp2) else (if (temp2 > temp) temp + 1 else temp2);
zig.mod-2
......@@ -3,5 +3,3 @@ name: leven
33main: src/lib.zig
44license: MIT
55description: Measure the difference between two slices using the Levenshtein distance algorithm
6dependencies:
7 - src: git https://github.com/nektro/zig-range