List.map in zig!

This commit is contained in:
Folkert 2021-02-17 15:38:55 +01:00
parent 821e750876
commit 42c5662872
6 changed files with 250 additions and 206 deletions

View file

@ -2,6 +2,13 @@ const builtin = @import("builtin");
const std = @import("std");
const testing = std.testing;
// List Module
const list = @import("list.zig");
comptime {
exportListFn(list.listMap, "map");
}
// Dict Module
const dict = @import("dict.zig");
const hash = @import("hash.zig");
@ -67,6 +74,10 @@ fn exportDictFn(comptime func: anytype, comptime func_name: []const u8) void {
exportBuiltinFn(func, "dict." ++ func_name);
}
fn exportListFn(comptime func: anytype, comptime func_name: []const u8) void {
exportBuiltinFn(func, "list." ++ func_name);
}
// Run all tests in imported modules
// https://github.com/ziglang/zig/blob/master/lib/std/std.zig#L94
test "" {