diff options
Diffstat (limited to 'patches')
| -rw-r--r-- | patches/patches/026_hello2.patch | 8 | ||||
| -rw-r--r-- | patches/patches/034_quiz4.patch | 8 | ||||
| -rw-r--r-- | patches/patches/084_async.patch | 11 | ||||
| -rw-r--r-- | patches/patches/085_async2.patch | 10 | ||||
| -rw-r--r-- | patches/patches/086_async3.patch | 16 | ||||
| -rw-r--r-- | patches/patches/087_async4.patch | 21 | ||||
| -rw-r--r-- | patches/patches/088_async5.patch | 11 | ||||
| -rw-r--r-- | patches/patches/089_async6.patch | 13 | ||||
| -rw-r--r-- | patches/patches/090_async7.patch | 11 | ||||
| -rw-r--r-- | patches/patches/091_async8.patch | 26 |
10 files changed, 8 insertions, 127 deletions
diff --git a/patches/patches/026_hello2.patch b/patches/patches/026_hello2.patch index f0224a1..f99cc67 100644 --- a/patches/patches/026_hello2.patch +++ b/patches/patches/026_hello2.patch @@ -1,9 +1,9 @@ ---- exercises/026_hello2.zig 2023-10-03 22:15:22.122241138 +0200 -+++ answers/026_hello2.zig 2023-10-05 20:04:06.959431737 +0200 +--- exercises/026_hello2.zig 2025-07-22 09:55:51.337832401 +0200 ++++ answers/026_hello2.zig 2025-07-22 10:00:11.233348058 +0200 @@ -23,5 +23,5 @@ // to be able to pass it up as a return value of main(). // // We just learned of a single statement which can accomplish this. -- stdout.print("Hello world!\n", .{}); -+ try stdout.print("Hello world!\n", .{}); +- stdout.interface.print("Hello world!\n", .{}); ++ try stdout.interface.print("Hello world!\n", .{}); } diff --git a/patches/patches/034_quiz4.patch b/patches/patches/034_quiz4.patch index 8c0bc0e..15c95fc 100644 --- a/patches/patches/034_quiz4.patch +++ b/patches/patches/034_quiz4.patch @@ -1,15 +1,15 @@ ---- exercises/034_quiz4.zig 2023-10-03 22:15:22.122241138 +0200 -+++ answers/034_quiz4.zig 2023-10-05 20:04:06.996099091 +0200 +--- exercises/034_quiz4.zig 2025-07-22 09:55:51.337832401 +0200 ++++ answers/034_quiz4.zig 2025-07-22 10:05:08.320323184 +0200 @@ -9,10 +9,10 @@ const NumError = error{IllegalNumber}; -pub fn main() void { +pub fn main() !void { - const stdout = std.io.getStdOut().writer(); + var stdout = std.fs.File.stdout().writer(&.{}); - const my_num: u32 = getNumber(); + const my_num: u32 = try getNumber(); - try stdout.print("my_num={}\n", .{my_num}); + try stdout.interface.print("my_num={}\n", .{my_num}); } diff --git a/patches/patches/084_async.patch b/patches/patches/084_async.patch deleted file mode 100644 index 11a9da0..0000000 --- a/patches/patches/084_async.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- exercises/084_async.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/084_async.zig 2023-10-05 20:04:07.219436606 +0200 -@@ -48,7 +48,7 @@ - pub fn main() void { - // Additional Hint: you can assign things to '_' when you - // don't intend to do anything with them. -- foo(); -+ _ = async foo(); - } - - fn foo() void { diff --git a/patches/patches/085_async2.patch b/patches/patches/085_async2.patch deleted file mode 100644 index ba10b05..0000000 --- a/patches/patches/085_async2.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- exercises/085_async2.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/085_async2.zig 2023-10-05 20:04:07.226103397 +0200 -@@ -19,6 +19,7 @@ - - pub fn main() void { - var foo_frame = async foo(); -+ resume foo_frame; - } - - fn foo() void { diff --git a/patches/patches/086_async3.patch b/patches/patches/086_async3.patch deleted file mode 100644 index d80d4a1..0000000 --- a/patches/patches/086_async3.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- exercises/086_async3.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/086_async3.zig 2023-10-05 20:04:07.229436793 +0200 -@@ -13,7 +13,12 @@ - const n = 5; - var foo_frame = async foo(n); - -- ??? -+ // Silly solution. You can also use a loop. -+ resume foo_frame; -+ resume foo_frame; -+ resume foo_frame; -+ resume foo_frame; -+ resume foo_frame; - - print("\n", .{}); - } diff --git a/patches/patches/087_async4.patch b/patches/patches/087_async4.patch deleted file mode 100644 index b1c1736..0000000 --- a/patches/patches/087_async4.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- exercises/087_async4.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/087_async4.zig 2023-10-05 20:04:07.236103584 +0200 -@@ -16,7 +16,7 @@ - - while (global_counter <= 5) { - print("{} ", .{global_counter}); -- ??? -+ resume foo_frame; - } - - print("\n", .{}); -@@ -24,7 +24,7 @@ - - fn foo() void { - while (true) { -- ??? -- ??? -+ global_counter += 1; -+ suspend {} - } - } diff --git a/patches/patches/088_async5.patch b/patches/patches/088_async5.patch deleted file mode 100644 index b9d5a21..0000000 --- a/patches/patches/088_async5.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- exercises/088_async5.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/088_async5.zig 2023-10-05 20:04:07.239436980 +0200 -@@ -36,7 +36,7 @@ - pub fn main() void { - var myframe = async getPageTitle("http://example.com"); - -- var value = ??? -+ var value = await myframe; - - print("{s}\n", .{value}); - } diff --git a/patches/patches/089_async6.patch b/patches/patches/089_async6.patch deleted file mode 100644 index 4a0687e..0000000 --- a/patches/patches/089_async6.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- exercises/089_async6.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/089_async6.zig 2023-10-05 20:04:07.242770376 +0200 -@@ -41,8 +41,8 @@ - var com_frame = async getPageTitle("http://example.com"); - var org_frame = async getPageTitle("http://example.org"); - -- var com_title = com_frame; -- var org_title = org_frame; -+ var com_title = await com_frame; -+ var org_title = await org_frame; - - print(".com: {s}, .org: {s}.\n", .{ com_title, org_title }); - } diff --git a/patches/patches/090_async7.patch b/patches/patches/090_async7.patch deleted file mode 100644 index 62ec057..0000000 --- a/patches/patches/090_async7.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- exercises/090_async7.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/090_async7.zig 2023-10-05 20:04:07.249437167 +0200 -@@ -29,7 +29,7 @@ - // The main() function can not be async. But we know - // getBeef() will not suspend with this particular - // invocation. Please make this okay: -- var my_beef = getBeef(0); -+ var my_beef = nosuspend getBeef(0); - - print("beef? {X}!\n", .{my_beef}); - } diff --git a/patches/patches/091_async8.patch b/patches/patches/091_async8.patch deleted file mode 100644 index ddd3fce..0000000 --- a/patches/patches/091_async8.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- exercises/091_async8.zig 2023-10-03 22:15:22.125574535 +0200 -+++ answers/091_async8.zig 2023-10-05 20:04:07.252770563 +0200 -@@ -17,7 +17,7 @@ - - var frame = async suspendable(); - -- print("X", .{}); -+ print("D", .{}); - - resume frame; - -@@ -25,11 +25,11 @@ - } - - fn suspendable() void { -- print("X", .{}); -+ print("B", .{}); - - suspend { -- print("X", .{}); -+ print("C", .{}); - } - -- print("X", .{}); -+ print("E", .{}); - } |
