Skip to content

lawrence-laz/zig-enumerable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zig Enumerable ⚡

Functional vibes for data processing as sequences.

const std = @import("std");
const enumerable = @import("enumerable");

test "example" {
    try expectEqualIter(
        "(1,2,3)",
        enumerable.from(std.mem.tokenizeAny(u8, "foo=1;bar=2;baz=3", "=;").buffer)
            .where(std.ascii.isDigit)
            .intersperse(',')
            .prepend('(')
            .append(')'),
    );
}

📦 Get started

zig fetch --save https://github.com/lawrence-laz/zig-enumerable/archive/master.tar.gz
// build.zig
const enumerable = b.dependency("enumerable", .{
    .target = target,
    .optimize = optimize,
});

exe.root_module.addImport("enumerable", enumerable.module("enumerable"));