|
2 | 2 | //! you are building an executable. If you are making a library, the convention |
3 | 3 | //! is to delete this file and start with root.zig instead. |
4 | 4 |
|
5 | | -const engine = @import("engine.zig"); |
| 5 | +const std = @import("std"); |
| 6 | +/// This imports the separate module containing `root.zig`. Take a look in `build.zig` for details. |
| 7 | +const lib = @import("micrograd"); |
6 | 8 |
|
7 | 9 | pub fn main() !void { |
8 | | - const value = engine.Value(f32).init(3.14); |
| 10 | + const value = lib.engine.Value(f32).init(3.14); |
9 | 11 |
|
10 | | - std.debug.print("Value: {}\n", .{value}); |
| 12 | + std.debug.print("{s}\n", .{value.toString()}); |
11 | 13 |
|
12 | | - const value2 = engine.Value(i32).init(0x01); |
13 | | - std.debug.print("Value2: {}\n", .{value2}); |
| 14 | + const value2 = lib.engine.Value(i32).init(0x01); |
| 15 | + std.debug.print("{s}\n", .{value2.toString()}); |
14 | 16 |
|
15 | 17 | // Prints to stderr (it's a shortcut based on `std.io.getStdErr()`) |
16 | 18 | std.debug.print("All your {s} are belong to us.\n", .{"codebase"}); |
@@ -48,8 +50,3 @@ test "fuzz example" { |
48 | 50 | }; |
49 | 51 | try std.testing.fuzz(Context{}, Context.testOne, .{}); |
50 | 52 | } |
51 | | - |
52 | | -const std = @import("std"); |
53 | | - |
54 | | -/// This imports the separate module containing `root.zig`. Take a look in `build.zig` for details. |
55 | | -const lib = @import("micrograd_lib"); |
0 commit comments