-
-
Save sarahzrf/0d1a5681ff52bbbcee0418febda78ab1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const warn = @import("std").debug.warn; | |
fn Arr(comptime len: i32, comptime T: type) type { | |
return if (len <= 0) void else | |
struct {head: T, tail: Arr(len - 1, T)}; | |
} | |
fn foo(comptime len: i32, a: Arr(len, i32)) %i32 { | |
return 3; | |
} | |
test "foo" { | |
warn("{}\n", foo(0, Arr(0, i32) {})); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment