From 6ad9774189fbd64b2f2c9519f4513ab34b0c3809 Mon Sep 17 00:00:00 2001 From: Dave Gauer Date: Fri, 12 Mar 2021 18:59:46 -0500 Subject: "999 is enough for anybody" triple-zero padding (#18) When I hit 999 exercises, I will finally have reached the ultimate state of soteriological release and no more exercises will be needed. The cycle will be complete. All that will be left is perfect quietude, freedom, and highest happiness. --- patches/patches/001_hello.patch | 4 ++++ patches/patches/002_std.patch | 4 ++++ patches/patches/003_assignment.patch | 12 ++++++++++++ patches/patches/004_arrays.patch | 12 ++++++++++++ patches/patches/005_arrays2.patch | 8 ++++++++ patches/patches/006_strings.patch | 12 ++++++++++++ patches/patches/007_strings2.patch | 8 ++++++++ patches/patches/008_quiz.patch | 14 ++++++++++++++ patches/patches/009_if.patch | 4 ++++ patches/patches/010_if2.patch | 4 ++++ patches/patches/011_while.patch | 4 ++++ patches/patches/012_while2.patch | 4 ++++ patches/patches/013_while3.patch | 6 ++++++ patches/patches/014_while4.patch | 4 ++++ patches/patches/015_for.patch | 4 ++++ patches/patches/016_for2.patch | 4 ++++ patches/patches/017_quiz2.patch | 16 ++++++++++++++++ patches/patches/018_functions.patch | 4 ++++ patches/patches/019_functions2.patch | 4 ++++ patches/patches/01_hello.patch | 4 ---- patches/patches/020_quiz3.patch | 18 ++++++++++++++++++ patches/patches/021_errors.patch | 8 ++++++++ patches/patches/022_errors2.patch | 4 ++++ patches/patches/023_errors3.patch | 8 ++++++++ patches/patches/024_errors4.patch | 10 ++++++++++ patches/patches/025_errors5.patch | 4 ++++ patches/patches/026_hello2.patch | 4 ++++ patches/patches/027_defer.patch | 4 ++++ patches/patches/028_defer2.patch | 4 ++++ patches/patches/029_errdefer.patch | 4 ++++ patches/patches/02_std.patch | 4 ---- patches/patches/030_switch.patch | 2 ++ patches/patches/031_switch2.patch | 2 ++ patches/patches/032_unreachable.patch | 2 ++ patches/patches/033_iferror.patch | 2 ++ patches/patches/034_quiz4.patch | 8 ++++++++ patches/patches/035_enums.patch | 4 ++++ patches/patches/036_enums2.patch | 12 ++++++++++++ patches/patches/037_structs.patch | 4 ++++ patches/patches/038_structs2.patch | 7 +++++++ patches/patches/039_pointers.patch | 4 ++++ patches/patches/03_assignment.patch | 12 ------------ patches/patches/040_pointers2.patch | 4 ++++ patches/patches/041_pointers3.patch | 4 ++++ patches/patches/042_pointers4.patch | 4 ++++ patches/patches/043_pointers5.patch | 4 ++++ patches/patches/044_quiz5.patch | 4 ++++ patches/patches/045_optionals.patch | 4 ++++ patches/patches/046_optionals2.patch | 21 +++++++++++++++++++++ patches/patches/047_methods.patch | 4 ++++ patches/patches/048_methods2.patch | 4 ++++ patches/patches/049_quiz6.patch | 11 +++++++++++ patches/patches/04_arrays.patch | 12 ------------ patches/patches/050_no_value.patch | 14 ++++++++++++++ patches/patches/051_values.patch | 12 ++++++++++++ patches/patches/052_slices.patch | 10 ++++++++++ patches/patches/053_slices2.patch | 20 ++++++++++++++++++++ patches/patches/054_manypointers.patch | 4 ++++ patches/patches/055_unions.patch | 6 ++++++ patches/patches/056_unions2.patch | 10 ++++++++++ patches/patches/057_unions3.patch | 4 ++++ patches/patches/05_arrays2.patch | 8 -------- patches/patches/06_strings.patch | 12 ------------ patches/patches/07_strings2.patch | 8 -------- patches/patches/08_quiz.patch | 14 -------------- patches/patches/09_if.patch | 4 ---- patches/patches/10_if2.patch | 4 ---- patches/patches/11_while.patch | 4 ---- patches/patches/12_while2.patch | 4 ---- patches/patches/13_while3.patch | 6 ------ patches/patches/14_while4.patch | 4 ---- patches/patches/15_for.patch | 4 ---- patches/patches/16_for2.patch | 4 ---- patches/patches/17_quiz2.patch | 16 ---------------- patches/patches/18_functions.patch | 4 ---- patches/patches/19_functions2.patch | 4 ---- patches/patches/20_quiz3.patch | 18 ------------------ patches/patches/21_errors.patch | 8 -------- patches/patches/22_errors2.patch | 4 ---- patches/patches/23_errors3.patch | 8 -------- patches/patches/24_errors4.patch | 10 ---------- patches/patches/25_errors5.patch | 4 ---- patches/patches/26_hello2.patch | 4 ---- patches/patches/27_defer.patch | 4 ---- patches/patches/28_defer2.patch | 4 ---- patches/patches/29_errdefer.patch | 4 ---- patches/patches/30_switch.patch | 2 -- patches/patches/31_switch2.patch | 2 -- patches/patches/32_unreachable.patch | 2 -- patches/patches/33_iferror.patch | 2 -- patches/patches/34_quiz4.patch | 8 -------- patches/patches/35_enums.patch | 4 ---- patches/patches/36_enums2.patch | 12 ------------ patches/patches/37_structs.patch | 4 ---- patches/patches/38_structs2.patch | 7 ------- patches/patches/39_pointers.patch | 4 ---- patches/patches/40_pointers2.patch | 4 ---- patches/patches/41_pointers3.patch | 4 ---- patches/patches/42_pointers4.patch | 4 ---- patches/patches/43_pointers5.patch | 4 ---- patches/patches/44_quiz5.patch | 4 ---- patches/patches/45_optionals.patch | 4 ---- patches/patches/46_optionals2.patch | 21 --------------------- patches/patches/47_methods.patch | 4 ---- patches/patches/48_methods2.patch | 4 ---- patches/patches/49_quiz6.patch | 11 ----------- patches/patches/50_no_value.patch | 14 -------------- patches/patches/51_values.patch | 12 ------------ patches/patches/52_slices.patch | 10 ---------- patches/patches/53_slices2.patch | 20 -------------------- patches/patches/54_manypointers.patch | 4 ---- patches/patches/55_unions.patch | 6 ------ patches/patches/56_unions2.patch | 10 ---------- patches/patches/57_unions3.patch | 4 ---- 114 files changed, 391 insertions(+), 391 deletions(-) create mode 100644 patches/patches/001_hello.patch create mode 100644 patches/patches/002_std.patch create mode 100644 patches/patches/003_assignment.patch create mode 100644 patches/patches/004_arrays.patch create mode 100644 patches/patches/005_arrays2.patch create mode 100644 patches/patches/006_strings.patch create mode 100644 patches/patches/007_strings2.patch create mode 100644 patches/patches/008_quiz.patch create mode 100644 patches/patches/009_if.patch create mode 100644 patches/patches/010_if2.patch create mode 100644 patches/patches/011_while.patch create mode 100644 patches/patches/012_while2.patch create mode 100644 patches/patches/013_while3.patch create mode 100644 patches/patches/014_while4.patch create mode 100644 patches/patches/015_for.patch create mode 100644 patches/patches/016_for2.patch create mode 100644 patches/patches/017_quiz2.patch create mode 100644 patches/patches/018_functions.patch create mode 100644 patches/patches/019_functions2.patch delete mode 100644 patches/patches/01_hello.patch create mode 100644 patches/patches/020_quiz3.patch create mode 100644 patches/patches/021_errors.patch create mode 100644 patches/patches/022_errors2.patch create mode 100644 patches/patches/023_errors3.patch create mode 100644 patches/patches/024_errors4.patch create mode 100644 patches/patches/025_errors5.patch create mode 100644 patches/patches/026_hello2.patch create mode 100644 patches/patches/027_defer.patch create mode 100644 patches/patches/028_defer2.patch create mode 100644 patches/patches/029_errdefer.patch delete mode 100644 patches/patches/02_std.patch create mode 100644 patches/patches/030_switch.patch create mode 100644 patches/patches/031_switch2.patch create mode 100644 patches/patches/032_unreachable.patch create mode 100644 patches/patches/033_iferror.patch create mode 100644 patches/patches/034_quiz4.patch create mode 100644 patches/patches/035_enums.patch create mode 100644 patches/patches/036_enums2.patch create mode 100644 patches/patches/037_structs.patch create mode 100644 patches/patches/038_structs2.patch create mode 100644 patches/patches/039_pointers.patch delete mode 100644 patches/patches/03_assignment.patch create mode 100644 patches/patches/040_pointers2.patch create mode 100644 patches/patches/041_pointers3.patch create mode 100644 patches/patches/042_pointers4.patch create mode 100644 patches/patches/043_pointers5.patch create mode 100644 patches/patches/044_quiz5.patch create mode 100644 patches/patches/045_optionals.patch create mode 100644 patches/patches/046_optionals2.patch create mode 100644 patches/patches/047_methods.patch create mode 100644 patches/patches/048_methods2.patch create mode 100644 patches/patches/049_quiz6.patch delete mode 100644 patches/patches/04_arrays.patch create mode 100644 patches/patches/050_no_value.patch create mode 100644 patches/patches/051_values.patch create mode 100644 patches/patches/052_slices.patch create mode 100644 patches/patches/053_slices2.patch create mode 100644 patches/patches/054_manypointers.patch create mode 100644 patches/patches/055_unions.patch create mode 100644 patches/patches/056_unions2.patch create mode 100644 patches/patches/057_unions3.patch delete mode 100644 patches/patches/05_arrays2.patch delete mode 100644 patches/patches/06_strings.patch delete mode 100644 patches/patches/07_strings2.patch delete mode 100644 patches/patches/08_quiz.patch delete mode 100644 patches/patches/09_if.patch delete mode 100644 patches/patches/10_if2.patch delete mode 100644 patches/patches/11_while.patch delete mode 100644 patches/patches/12_while2.patch delete mode 100644 patches/patches/13_while3.patch delete mode 100644 patches/patches/14_while4.patch delete mode 100644 patches/patches/15_for.patch delete mode 100644 patches/patches/16_for2.patch delete mode 100644 patches/patches/17_quiz2.patch delete mode 100644 patches/patches/18_functions.patch delete mode 100644 patches/patches/19_functions2.patch delete mode 100644 patches/patches/20_quiz3.patch delete mode 100644 patches/patches/21_errors.patch delete mode 100644 patches/patches/22_errors2.patch delete mode 100644 patches/patches/23_errors3.patch delete mode 100644 patches/patches/24_errors4.patch delete mode 100644 patches/patches/25_errors5.patch delete mode 100644 patches/patches/26_hello2.patch delete mode 100644 patches/patches/27_defer.patch delete mode 100644 patches/patches/28_defer2.patch delete mode 100644 patches/patches/29_errdefer.patch delete mode 100644 patches/patches/30_switch.patch delete mode 100644 patches/patches/31_switch2.patch delete mode 100644 patches/patches/32_unreachable.patch delete mode 100644 patches/patches/33_iferror.patch delete mode 100644 patches/patches/34_quiz4.patch delete mode 100644 patches/patches/35_enums.patch delete mode 100644 patches/patches/36_enums2.patch delete mode 100644 patches/patches/37_structs.patch delete mode 100644 patches/patches/38_structs2.patch delete mode 100644 patches/patches/39_pointers.patch delete mode 100644 patches/patches/40_pointers2.patch delete mode 100644 patches/patches/41_pointers3.patch delete mode 100644 patches/patches/42_pointers4.patch delete mode 100644 patches/patches/43_pointers5.patch delete mode 100644 patches/patches/44_quiz5.patch delete mode 100644 patches/patches/45_optionals.patch delete mode 100644 patches/patches/46_optionals2.patch delete mode 100644 patches/patches/47_methods.patch delete mode 100644 patches/patches/48_methods2.patch delete mode 100644 patches/patches/49_quiz6.patch delete mode 100644 patches/patches/50_no_value.patch delete mode 100644 patches/patches/51_values.patch delete mode 100644 patches/patches/52_slices.patch delete mode 100644 patches/patches/53_slices2.patch delete mode 100644 patches/patches/54_manypointers.patch delete mode 100644 patches/patches/55_unions.patch delete mode 100644 patches/patches/56_unions2.patch delete mode 100644 patches/patches/57_unions3.patch (limited to 'patches') diff --git a/patches/patches/001_hello.patch b/patches/patches/001_hello.patch new file mode 100644 index 0000000..fb360a7 --- /dev/null +++ b/patches/patches/001_hello.patch @@ -0,0 +1,4 @@ +19c19 +< fn main() void { +--- +> pub fn main() void { diff --git a/patches/patches/002_std.patch b/patches/patches/002_std.patch new file mode 100644 index 0000000..6c97adb --- /dev/null +++ b/patches/patches/002_std.patch @@ -0,0 +1,4 @@ +14c14 +< ??? = @import("std"); +--- +> const std = @import("std"); diff --git a/patches/patches/003_assignment.patch b/patches/patches/003_assignment.patch new file mode 100644 index 0000000..bef4b24 --- /dev/null +++ b/patches/patches/003_assignment.patch @@ -0,0 +1,12 @@ +37c37 +< const n: u8 = 50; +--- +> var n: u8 = 50; +40c40 +< const pi: u8 = 314159; +--- +> const pi: u32 = 314159; +42c42 +< const negative_eleven: u8 = -11; +--- +> const negative_eleven: i8 = -11; diff --git a/patches/patches/004_arrays.patch b/patches/patches/004_arrays.patch new file mode 100644 index 0000000..c6f9de3 --- /dev/null +++ b/patches/patches/004_arrays.patch @@ -0,0 +1,12 @@ +30c30 +< const some_primes = [_]u8{ 1, 3, 5, 7, 11, 13, 17, 19 }; +--- +> var some_primes = [_]u8{ 1, 3, 5, 7, 11, 13, 17, 19 }; +43c43 +< const fourth = some_primes[???]; +--- +> const fourth = some_primes[3]; +47c47 +< const length = some_primes.???; +--- +> const length = some_primes.len; diff --git a/patches/patches/005_arrays2.patch b/patches/patches/005_arrays2.patch new file mode 100644 index 0000000..1e7b6b1 --- /dev/null +++ b/patches/patches/005_arrays2.patch @@ -0,0 +1,8 @@ +23c23 +< const leet = ???; +--- +> const leet = le ++ et; +28c28 +< const bit_pattern = [_]u8{ ??? } ** 3; +--- +> const bit_pattern = [_]u8{ 1, 0, 0, 1 } ** 3; diff --git a/patches/patches/006_strings.patch b/patches/patches/006_strings.patch new file mode 100644 index 0000000..040a73c --- /dev/null +++ b/patches/patches/006_strings.patch @@ -0,0 +1,12 @@ +22c22 +< const d: u8 = ziggy[???]; +--- +> const d: u8 = ziggy[4]; +26c26 +< const laugh = "ha " ???; +--- +> const laugh = "ha " ** 3; +33c33 +< const major_tom = major ??? tom; +--- +> const major_tom = major ++ " " ++ tom; diff --git a/patches/patches/007_strings2.patch b/patches/patches/007_strings2.patch new file mode 100644 index 0000000..34cd053 --- /dev/null +++ b/patches/patches/007_strings2.patch @@ -0,0 +1,8 @@ +18,20c18,20 +< Ziggy played guitar +< Jamming good with Andrew Kelley +< And the Spiders from Mars +--- +> \\Ziggy played guitar +> \\Jamming good with Andrew Kelley +> \\And the Spiders from Mars diff --git a/patches/patches/008_quiz.patch b/patches/patches/008_quiz.patch new file mode 100644 index 0000000..3d35a5a --- /dev/null +++ b/patches/patches/008_quiz.patch @@ -0,0 +1,14 @@ +16c16 +< const x: u8 = 1; +--- +> var x: u8 = 1; +27c27 +< lang[???] = letters[x]; +--- +> lang[1] = letters[x]; +29,30c29,30 +< x = ???; +< lang[2] = letters[???]; +--- +> x = 5; +> lang[2] = letters[x]; diff --git a/patches/patches/009_if.patch b/patches/patches/009_if.patch new file mode 100644 index 0000000..46579ad --- /dev/null +++ b/patches/patches/009_if.patch @@ -0,0 +1,4 @@ +26c26 +< if (foo) { +--- +> if (foo == 1) { diff --git a/patches/patches/010_if2.patch b/patches/patches/010_if2.patch new file mode 100644 index 0000000..e78f644 --- /dev/null +++ b/patches/patches/010_if2.patch @@ -0,0 +1,4 @@ +13c13 +< var price: u8 = if ???; +--- +> var price: u8 = if (discount) 17 else 20; diff --git a/patches/patches/011_while.patch b/patches/patches/011_while.patch new file mode 100644 index 0000000..a892191 --- /dev/null +++ b/patches/patches/011_while.patch @@ -0,0 +1,4 @@ +24c24 +< while (???) { +--- +> while (n < 1024) { diff --git a/patches/patches/012_while2.patch b/patches/patches/012_while2.patch new file mode 100644 index 0000000..29ae763 --- /dev/null +++ b/patches/patches/012_while2.patch @@ -0,0 +1,4 @@ +28c28 +< while (n < 1000) : ??? { +--- +> while (n < 1000) : (n *= 2) { diff --git a/patches/patches/013_while3.patch b/patches/patches/013_while3.patch new file mode 100644 index 0000000..b0172da --- /dev/null +++ b/patches/patches/013_while3.patch @@ -0,0 +1,6 @@ +27,28c27,28 +< if (n % 3 == 0) ???; +< if (n % 5 == 0) ???; +--- +> if (n % 3 == 0) continue; +> if (n % 5 == 0) continue; diff --git a/patches/patches/014_while4.patch b/patches/patches/014_while4.patch new file mode 100644 index 0000000..fb67587 --- /dev/null +++ b/patches/patches/014_while4.patch @@ -0,0 +1,4 @@ +21c21 +< if (???) ???; +--- +> if (n == 4) break; diff --git a/patches/patches/015_for.patch b/patches/patches/015_for.patch new file mode 100644 index 0000000..e937221 --- /dev/null +++ b/patches/patches/015_for.patch @@ -0,0 +1,4 @@ +18c18 +< for (???) |???| { +--- +> for (story) |scene| { diff --git a/patches/patches/016_for2.patch b/patches/patches/016_for2.patch new file mode 100644 index 0000000..5aba37f --- /dev/null +++ b/patches/patches/016_for2.patch @@ -0,0 +1,4 @@ +27c27 +< for (bits) |bit, ???| { +--- +> for (bits) |bit, i| { diff --git a/patches/patches/017_quiz2.patch b/patches/patches/017_quiz2.patch new file mode 100644 index 0000000..b46dab6 --- /dev/null +++ b/patches/patches/017_quiz2.patch @@ -0,0 +1,16 @@ +12c12 +< const std = import standard library; +--- +> const std = @import("std"); +14c14 +< function main() void { +--- +> pub fn main() void { +19c19 +< ??? (i <= stop_at) : (i += 1) { +--- +> while (i <= stop_at) : (i += 1) { +23c23 +< std.debug.print("{}", .{???}); +--- +> std.debug.print("{}", .{i}); diff --git a/patches/patches/018_functions.patch b/patches/patches/018_functions.patch new file mode 100644 index 0000000..dd3f2f6 --- /dev/null +++ b/patches/patches/018_functions.patch @@ -0,0 +1,4 @@ +31c31 +< ??? deepThought() ??? { +--- +> fn deepThought() u8 { diff --git a/patches/patches/019_functions2.patch b/patches/patches/019_functions2.patch new file mode 100644 index 0000000..254889a --- /dev/null +++ b/patches/patches/019_functions2.patch @@ -0,0 +1,4 @@ +25c25 +< fn twoToThe(???) u32 { +--- +> fn twoToThe(my_number: u32) u32 { diff --git a/patches/patches/01_hello.patch b/patches/patches/01_hello.patch deleted file mode 100644 index fb360a7..0000000 --- a/patches/patches/01_hello.patch +++ /dev/null @@ -1,4 +0,0 @@ -19c19 -< fn main() void { ---- -> pub fn main() void { diff --git a/patches/patches/020_quiz3.patch b/patches/patches/020_quiz3.patch new file mode 100644 index 0000000..6a00d31 --- /dev/null +++ b/patches/patches/020_quiz3.patch @@ -0,0 +1,18 @@ +24,25c24,25 +< fn printPowersOfTwo(numbers: [4]u16) ??? { +< loop (numbers) |n| { +--- +> fn printPowersOfTwo(numbers: [4]u16) void { +> for (numbers) |n| { +34c34 +< fn twoToThe(number: u16) ??? { +--- +> fn twoToThe(number: u16) u16 { +38c38 +< loop (n < number) : (n += 1) { +--- +> while (n < number) : (n += 1) { +42c42 +< return ???; +--- +> return total; diff --git a/patches/patches/021_errors.patch b/patches/patches/021_errors.patch new file mode 100644 index 0000000..b37b3c8 --- /dev/null +++ b/patches/patches/021_errors.patch @@ -0,0 +1,8 @@ +12c12 +< ???, +--- +> TooSmall, +29c29 +< if (???) { +--- +> if (number_error == MyNumberError.TooSmall) { diff --git a/patches/patches/022_errors2.patch b/patches/patches/022_errors2.patch new file mode 100644 index 0000000..0501159 --- /dev/null +++ b/patches/patches/022_errors2.patch @@ -0,0 +1,4 @@ +22c22 +< var my_number: ??? = 5; +--- +> var my_number: MyNumberError!u8 = 5; diff --git a/patches/patches/023_errors3.patch b/patches/patches/023_errors3.patch new file mode 100644 index 0000000..a850116 --- /dev/null +++ b/patches/patches/023_errors3.patch @@ -0,0 +1,8 @@ +15c15 +< var b: u32 = addTwenty(4) ??? 22; +--- +> var b: u32 = addTwenty(4) catch 22; +22c22 +< fn addTwenty(n: u32) ??? { +--- +> fn addTwenty(n: u32) MyNumberError!u32 { diff --git a/patches/patches/024_errors4.patch b/patches/patches/024_errors4.patch new file mode 100644 index 0000000..bb3fc8f --- /dev/null +++ b/patches/patches/024_errors4.patch @@ -0,0 +1,10 @@ +62c62,68 +< return detectProblems(n) ??? +--- +> return detectProblems(n) catch |err| { +> if (err == MyNumberError.TooSmall) { +> return 10; +> } +> +> return err; +> }; diff --git a/patches/patches/025_errors5.patch b/patches/patches/025_errors5.patch new file mode 100644 index 0000000..8aa59d4 --- /dev/null +++ b/patches/patches/025_errors5.patch @@ -0,0 +1,4 @@ +29c29 +< var x = detect(n); +--- +> var x = try detect(n); diff --git a/patches/patches/026_hello2.patch b/patches/patches/026_hello2.patch new file mode 100644 index 0000000..0065da5 --- /dev/null +++ b/patches/patches/026_hello2.patch @@ -0,0 +1,4 @@ +22c22 +< stdout.print("Hello world!\n", .{}); +--- +> try stdout.print("Hello world!\n", .{}); diff --git a/patches/patches/027_defer.patch b/patches/patches/027_defer.patch new file mode 100644 index 0000000..6ff7f98 --- /dev/null +++ b/patches/patches/027_defer.patch @@ -0,0 +1,4 @@ +23c23 +< std.debug.print("Two\n", .{}); +--- +> defer std.debug.print("Two\n", .{}); diff --git a/patches/patches/028_defer2.patch b/patches/patches/028_defer2.patch new file mode 100644 index 0000000..c042c45 --- /dev/null +++ b/patches/patches/028_defer2.patch @@ -0,0 +1,4 @@ +21c21 +< std.debug.print(") ", .{}); // <---- how!? +--- +> defer std.debug.print(") ", .{}); // <---- how!? diff --git a/patches/patches/029_errdefer.patch b/patches/patches/029_errdefer.patch new file mode 100644 index 0000000..f93c56f --- /dev/null +++ b/patches/patches/029_errdefer.patch @@ -0,0 +1,4 @@ +35c34 +< std.debug.print("failed!\n", .{}); +--- +> errdefer std.debug.print("failed!\n", .{}); diff --git a/patches/patches/02_std.patch b/patches/patches/02_std.patch deleted file mode 100644 index 6c97adb..0000000 --- a/patches/patches/02_std.patch +++ /dev/null @@ -1,4 +0,0 @@ -14c14 -< ??? = @import("std"); ---- -> const std = @import("std"); diff --git a/patches/patches/030_switch.patch b/patches/patches/030_switch.patch new file mode 100644 index 0000000..05cbe1a --- /dev/null +++ b/patches/patches/030_switch.patch @@ -0,0 +1,2 @@ +48a49 +> else => std.debug.print("?", .{}), diff --git a/patches/patches/031_switch2.patch b/patches/patches/031_switch2.patch new file mode 100644 index 0000000..f786762 --- /dev/null +++ b/patches/patches/031_switch2.patch @@ -0,0 +1,2 @@ +33a34 +> else => '!', diff --git a/patches/patches/032_unreachable.patch b/patches/patches/032_unreachable.patch new file mode 100644 index 0000000..0883932 --- /dev/null +++ b/patches/patches/032_unreachable.patch @@ -0,0 +1,2 @@ +37a38 +> else => unreachable, diff --git a/patches/patches/033_iferror.patch b/patches/patches/033_iferror.patch new file mode 100644 index 0000000..62904db --- /dev/null +++ b/patches/patches/033_iferror.patch @@ -0,0 +1,2 @@ +36a37 +> MyNumberError.TooSmall => std.debug.print("<4. ", .{}), diff --git a/patches/patches/034_quiz4.patch b/patches/patches/034_quiz4.patch new file mode 100644 index 0000000..b259352 --- /dev/null +++ b/patches/patches/034_quiz4.patch @@ -0,0 +1,8 @@ +12c12 +< pub fn main() void { +--- +> pub fn main() !void { +15c15 +< const my_num: u32 = getNumber(); +--- +> const my_num: u32 = try getNumber(); diff --git a/patches/patches/035_enums.patch b/patches/patches/035_enums.patch new file mode 100644 index 0000000..ed2344b --- /dev/null +++ b/patches/patches/035_enums.patch @@ -0,0 +1,4 @@ +23c23 +< const Ops = enum { ??? }; +--- +> const Ops = enum { dec, inc, pow }; diff --git a/patches/patches/036_enums2.patch b/patches/patches/036_enums2.patch new file mode 100644 index 0000000..54a7094 --- /dev/null +++ b/patches/patches/036_enums2.patch @@ -0,0 +1,12 @@ +32c32 +< blue = ???, +--- +> blue = 0x0000ff, +54c54 +< \\ Blue +--- +> \\ Blue +59c59 +< @enumToInt(???), // Oops! We're missing something! +--- +> @enumToInt(Color.blue), // Oops! We're missing something! diff --git a/patches/patches/037_structs.patch b/patches/patches/037_structs.patch new file mode 100644 index 0000000..c26510d --- /dev/null +++ b/patches/patches/037_structs.patch @@ -0,0 +1,4 @@ +38a39 +> health: u8, +46a48 +> .health = 100, diff --git a/patches/patches/038_structs2.patch b/patches/patches/038_structs2.patch new file mode 100644 index 0000000..5d0d188 --- /dev/null +++ b/patches/patches/038_structs2.patch @@ -0,0 +1,7 @@ +44a45,50 +> chars[1] = Character{ +> .class = Class.bard, +> .gold = 10, +> .health = 100, +> .experience = 20, +> }; diff --git a/patches/patches/039_pointers.patch b/patches/patches/039_pointers.patch new file mode 100644 index 0000000..57d67e5 --- /dev/null +++ b/patches/patches/039_pointers.patch @@ -0,0 +1,4 @@ +33c33 +< num2 = ???; +--- +> num2 = num1_pointer.*; diff --git a/patches/patches/03_assignment.patch b/patches/patches/03_assignment.patch deleted file mode 100644 index bef4b24..0000000 --- a/patches/patches/03_assignment.patch +++ /dev/null @@ -1,12 +0,0 @@ -37c37 -< const n: u8 = 50; ---- -> var n: u8 = 50; -40c40 -< const pi: u8 = 314159; ---- -> const pi: u32 = 314159; -42c42 -< const negative_eleven: u8 = -11; ---- -> const negative_eleven: i8 = -11; diff --git a/patches/patches/040_pointers2.patch b/patches/patches/040_pointers2.patch new file mode 100644 index 0000000..a69cb20 --- /dev/null +++ b/patches/patches/040_pointers2.patch @@ -0,0 +1,4 @@ +24c24 +< const b: *u8 = &a; // fix this! +--- +> const b: *const u8 = &a; // fix this! diff --git a/patches/patches/041_pointers3.patch b/patches/patches/041_pointers3.patch new file mode 100644 index 0000000..02f7744 --- /dev/null +++ b/patches/patches/041_pointers3.patch @@ -0,0 +1,4 @@ +34c34 +< ??? p: ??? = undefined; +--- +> var p: *u8 = undefined; diff --git a/patches/patches/042_pointers4.patch b/patches/patches/042_pointers4.patch new file mode 100644 index 0000000..29ca2d0 --- /dev/null +++ b/patches/patches/042_pointers4.patch @@ -0,0 +1,4 @@ +31c31 +< ??? = 5; // fix me! +--- +> x.* = 5; // fix me! diff --git a/patches/patches/043_pointers5.patch b/patches/patches/043_pointers5.patch new file mode 100644 index 0000000..8a73551 --- /dev/null +++ b/patches/patches/043_pointers5.patch @@ -0,0 +1,4 @@ +60c60 +< printCharacter(???); +--- +> printCharacter(&glorp); diff --git a/patches/patches/044_quiz5.patch b/patches/patches/044_quiz5.patch new file mode 100644 index 0000000..44d4451 --- /dev/null +++ b/patches/patches/044_quiz5.patch @@ -0,0 +1,4 @@ +21a22 +> var elephantB = Elephant{ .letter = 'B' }; +27a29 +> elephantB.tail = &elephantC; diff --git a/patches/patches/045_optionals.patch b/patches/patches/045_optionals.patch new file mode 100644 index 0000000..c945b5a --- /dev/null +++ b/patches/patches/045_optionals.patch @@ -0,0 +1,4 @@ +32c32 +< var answer: u8 = result; +--- +> var answer: u8 = result orelse 42; diff --git a/patches/patches/046_optionals2.patch b/patches/patches/046_optionals2.patch new file mode 100644 index 0000000..10705d9 --- /dev/null +++ b/patches/patches/046_optionals2.patch @@ -0,0 +1,21 @@ +8,19d7 +< // We also introduce the handy ".?" shortcut: +< // +< // const foo = bar.?; +< // +< // is the same as +< // +< // const foo = bar orelse unreachable; +< // +< // See if you can find where we use this shortcut below. +< // +< // Now let's make those elephant tails optional! +< // +24c12 +< tail: *Elephant = null, // Hmm... tail needs something... +--- +> tail: ?*Elephant = null, // <---- make this optional! +54c42 +< if (e.tail == null) ???; +--- +> if (e.tail == null) break; diff --git a/patches/patches/047_methods.patch b/patches/patches/047_methods.patch new file mode 100644 index 0000000..cde93af --- /dev/null +++ b/patches/patches/047_methods.patch @@ -0,0 +1,4 @@ +84c84 +< ???.zap(heat_ray_strength); +--- +> alien.zap(heat_ray_strength); diff --git a/patches/patches/048_methods2.patch b/patches/patches/048_methods2.patch new file mode 100644 index 0000000..781a99e --- /dev/null +++ b/patches/patches/048_methods2.patch @@ -0,0 +1,4 @@ +57c57 +< e = e.???; // Which method do we want here? +--- +> e = e.getTail(); // Which method do we want here? diff --git a/patches/patches/049_quiz6.patch b/patches/patches/049_quiz6.patch new file mode 100644 index 0000000..83f9faf --- /dev/null +++ b/patches/patches/049_quiz6.patch @@ -0,0 +1,11 @@ +28a29,31 +> pub fn getTrunk(self: *Elephant) *Elephant { +> return self.trunk.?; +> } +30,31c33,35 +< ??? +< +--- +> pub fn hasTrunk(self: *Elephant) bool { +> return (self.trunk != null); +> } diff --git a/patches/patches/04_arrays.patch b/patches/patches/04_arrays.patch deleted file mode 100644 index c6f9de3..0000000 --- a/patches/patches/04_arrays.patch +++ /dev/null @@ -1,12 +0,0 @@ -30c30 -< const some_primes = [_]u8{ 1, 3, 5, 7, 11, 13, 17, 19 }; ---- -> var some_primes = [_]u8{ 1, 3, 5, 7, 11, 13, 17, 19 }; -43c43 -< const fourth = some_primes[???]; ---- -> const fourth = some_primes[3]; -47c47 -< const length = some_primes.???; ---- -> const length = some_primes.len; diff --git a/patches/patches/050_no_value.patch b/patches/patches/050_no_value.patch new file mode 100644 index 0000000..79db0a3 --- /dev/null +++ b/patches/patches/050_no_value.patch @@ -0,0 +1,14 @@ +68c68 +< var first_line1: *const [16]u8 = ???; +--- +> var first_line1: *const [16]u8 = undefined; +71c71 +< var first_line2: Err!*const [21]u8 = ???; +--- +> var first_line2: Err!*const [21]u8 = Err.Cthulhu; +79,80c79,80 +< fn printSecondLine() ??? { +< var second_line2: ?*const [18]u8 = ???; +--- +> fn printSecondLine() void { +> var second_line2: ?*const [18]u8 = null; diff --git a/patches/patches/051_values.patch b/patches/patches/051_values.patch new file mode 100644 index 0000000..43d1f65 --- /dev/null +++ b/patches/patches/051_values.patch @@ -0,0 +1,12 @@ +96c96 +< const print = ???; +--- +> const print = std.debug.print; +152c152 +< levelUp(glorp, reward_xp); +--- +> levelUp(&glorp, reward_xp); +157c157 +< fn levelUp(character_access: Character, xp: u32) void { +--- +> fn levelUp(character_access: *Character, xp: u32) void { diff --git a/patches/patches/052_slices.patch b/patches/patches/052_slices.patch new file mode 100644 index 0000000..80f8d72 --- /dev/null +++ b/patches/patches/052_slices.patch @@ -0,0 +1,10 @@ +34,35c34,35 +< const hand1: []u8 = cards[???]; +< const hand2: []u8 = cards[???]; +--- +> const hand1: []u8 = cards[0..4]; +> const hand2: []u8 = cards[4..]; +45c45 +< fn printHand(hand: ???) void { +--- +> fn printHand(hand: []u8) void { diff --git a/patches/patches/053_slices2.patch b/patches/patches/053_slices2.patch new file mode 100644 index 0000000..f5403a2 --- /dev/null +++ b/patches/patches/053_slices2.patch @@ -0,0 +1,20 @@ +20,22c20,22 +< const base1: []u8 = scrambled[15..23]; +< const base2: []u8 = scrambled[6..10]; +< const base3: []u8 = scrambled[32..]; +--- +> const base1: []const u8 = scrambled[15..23]; +> const base2: []const u8 = scrambled[6..10]; +> const base3: []const u8 = scrambled[32..]; +25,27c25,27 +< const justice1: []u8 = scrambled[11..14]; +< const justice2: []u8 = scrambled[0..5]; +< const justice3: []u8 = scrambled[24..31]; +--- +> const justice1: []const u8 = scrambled[11..14]; +> const justice2: []const u8 = scrambled[0..5]; +> const justice3: []const u8 = scrambled[24..31]; +33c33 +< fn printPhrase(part1: []u8, part2: []u8, part3: []u8) void { +--- +> fn printPhrase(part1: []const u8, part2: []const u8, part3: []const u8) void { diff --git a/patches/patches/054_manypointers.patch b/patches/patches/054_manypointers.patch new file mode 100644 index 0000000..82824e8 --- /dev/null +++ b/patches/patches/054_manypointers.patch @@ -0,0 +1,4 @@ +33c33 +< const zen12_string: []const u8 = zen_manyptr; +--- +> const zen12_string: []const u8 = zen_manyptr[0..21]; diff --git a/patches/patches/055_unions.patch b/patches/patches/055_unions.patch new file mode 100644 index 0000000..c362f20 --- /dev/null +++ b/patches/patches/055_unions.patch @@ -0,0 +1,6 @@ +62,63c62,63 +< printInsect(ant, AntOrBee.c); +< printInsect(bee, AntOrBee.c); +--- +> printInsect(ant, AntOrBee.a); +> printInsect(bee, AntOrBee.b); diff --git a/patches/patches/056_unions2.patch b/patches/patches/056_unions2.patch new file mode 100644 index 0000000..7341f7a --- /dev/null +++ b/patches/patches/056_unions2.patch @@ -0,0 +1,10 @@ +47,48c47,48 +< printInsect(???); +< printInsect(???); +--- +> printInsect(ant); +> printInsect(bee); +54c54 +< switch (???) { +--- +> switch (insect) { diff --git a/patches/patches/057_unions3.patch b/patches/patches/057_unions3.patch new file mode 100644 index 0000000..17e27a2 --- /dev/null +++ b/patches/patches/057_unions3.patch @@ -0,0 +1,4 @@ +18c18 +< const Insect = union(InsectStat) { +--- +> const Insect = union(enum) { diff --git a/patches/patches/05_arrays2.patch b/patches/patches/05_arrays2.patch deleted file mode 100644 index 1e7b6b1..0000000 --- a/patches/patches/05_arrays2.patch +++ /dev/null @@ -1,8 +0,0 @@ -23c23 -< const leet = ???; ---- -> const leet = le ++ et; -28c28 -< const bit_pattern = [_]u8{ ??? } ** 3; ---- -> const bit_pattern = [_]u8{ 1, 0, 0, 1 } ** 3; diff --git a/patches/patches/06_strings.patch b/patches/patches/06_strings.patch deleted file mode 100644 index 040a73c..0000000 --- a/patches/patches/06_strings.patch +++ /dev/null @@ -1,12 +0,0 @@ -22c22 -< const d: u8 = ziggy[???]; ---- -> const d: u8 = ziggy[4]; -26c26 -< const laugh = "ha " ???; ---- -> const laugh = "ha " ** 3; -33c33 -< const major_tom = major ??? tom; ---- -> const major_tom = major ++ " " ++ tom; diff --git a/patches/patches/07_strings2.patch b/patches/patches/07_strings2.patch deleted file mode 100644 index 34cd053..0000000 --- a/patches/patches/07_strings2.patch +++ /dev/null @@ -1,8 +0,0 @@ -18,20c18,20 -< Ziggy played guitar -< Jamming good with Andrew Kelley -< And the Spiders from Mars ---- -> \\Ziggy played guitar -> \\Jamming good with Andrew Kelley -> \\And the Spiders from Mars diff --git a/patches/patches/08_quiz.patch b/patches/patches/08_quiz.patch deleted file mode 100644 index 3d35a5a..0000000 --- a/patches/patches/08_quiz.patch +++ /dev/null @@ -1,14 +0,0 @@ -16c16 -< const x: u8 = 1; ---- -> var x: u8 = 1; -27c27 -< lang[???] = letters[x]; ---- -> lang[1] = letters[x]; -29,30c29,30 -< x = ???; -< lang[2] = letters[???]; ---- -> x = 5; -> lang[2] = letters[x]; diff --git a/patches/patches/09_if.patch b/patches/patches/09_if.patch deleted file mode 100644 index 46579ad..0000000 --- a/patches/patches/09_if.patch +++ /dev/null @@ -1,4 +0,0 @@ -26c26 -< if (foo) { ---- -> if (foo == 1) { diff --git a/patches/patches/10_if2.patch b/patches/patches/10_if2.patch deleted file mode 100644 index e78f644..0000000 --- a/patches/patches/10_if2.patch +++ /dev/null @@ -1,4 +0,0 @@ -13c13 -< var price: u8 = if ???; ---- -> var price: u8 = if (discount) 17 else 20; diff --git a/patches/patches/11_while.patch b/patches/patches/11_while.patch deleted file mode 100644 index a892191..0000000 --- a/patches/patches/11_while.patch +++ /dev/null @@ -1,4 +0,0 @@ -24c24 -< while (???) { ---- -> while (n < 1024) { diff --git a/patches/patches/12_while2.patch b/patches/patches/12_while2.patch deleted file mode 100644 index 29ae763..0000000 --- a/patches/patches/12_while2.patch +++ /dev/null @@ -1,4 +0,0 @@ -28c28 -< while (n < 1000) : ??? { ---- -> while (n < 1000) : (n *= 2) { diff --git a/patches/patches/13_while3.patch b/patches/patches/13_while3.patch deleted file mode 100644 index b0172da..0000000 --- a/patches/patches/13_while3.patch +++ /dev/null @@ -1,6 +0,0 @@ -27,28c27,28 -< if (n % 3 == 0) ???; -< if (n % 5 == 0) ???; ---- -> if (n % 3 == 0) continue; -> if (n % 5 == 0) continue; diff --git a/patches/patches/14_while4.patch b/patches/patches/14_while4.patch deleted file mode 100644 index fb67587..0000000 --- a/patches/patches/14_while4.patch +++ /dev/null @@ -1,4 +0,0 @@ -21c21 -< if (???) ???; ---- -> if (n == 4) break; diff --git a/patches/patches/15_for.patch b/patches/patches/15_for.patch deleted file mode 100644 index e937221..0000000 --- a/patches/patches/15_for.patch +++ /dev/null @@ -1,4 +0,0 @@ -18c18 -< for (???) |???| { ---- -> for (story) |scene| { diff --git a/patches/patches/16_for2.patch b/patches/patches/16_for2.patch deleted file mode 100644 index 5aba37f..0000000 --- a/patches/patches/16_for2.patch +++ /dev/null @@ -1,4 +0,0 @@ -27c27 -< for (bits) |bit, ???| { ---- -> for (bits) |bit, i| { diff --git a/patches/patches/17_quiz2.patch b/patches/patches/17_quiz2.patch deleted file mode 100644 index b46dab6..0000000 --- a/patches/patches/17_quiz2.patch +++ /dev/null @@ -1,16 +0,0 @@ -12c12 -< const std = import standard library; ---- -> const std = @import("std"); -14c14 -< function main() void { ---- -> pub fn main() void { -19c19 -< ??? (i <= stop_at) : (i += 1) { ---- -> while (i <= stop_at) : (i += 1) { -23c23 -< std.debug.print("{}", .{???}); ---- -> std.debug.print("{}", .{i}); diff --git a/patches/patches/18_functions.patch b/patches/patches/18_functions.patch deleted file mode 100644 index dd3f2f6..0000000 --- a/patches/patches/18_functions.patch +++ /dev/null @@ -1,4 +0,0 @@ -31c31 -< ??? deepThought() ??? { ---- -> fn deepThought() u8 { diff --git a/patches/patches/19_functions2.patch b/patches/patches/19_functions2.patch deleted file mode 100644 index 254889a..0000000 --- a/patches/patches/19_functions2.patch +++ /dev/null @@ -1,4 +0,0 @@ -25c25 -< fn twoToThe(???) u32 { ---- -> fn twoToThe(my_number: u32) u32 { diff --git a/patches/patches/20_quiz3.patch b/patches/patches/20_quiz3.patch deleted file mode 100644 index 6a00d31..0000000 --- a/patches/patches/20_quiz3.patch +++ /dev/null @@ -1,18 +0,0 @@ -24,25c24,25 -< fn printPowersOfTwo(numbers: [4]u16) ??? { -< loop (numbers) |n| { ---- -> fn printPowersOfTwo(numbers: [4]u16) void { -> for (numbers) |n| { -34c34 -< fn twoToThe(number: u16) ??? { ---- -> fn twoToThe(number: u16) u16 { -38c38 -< loop (n < number) : (n += 1) { ---- -> while (n < number) : (n += 1) { -42c42 -< return ???; ---- -> return total; diff --git a/patches/patches/21_errors.patch b/patches/patches/21_errors.patch deleted file mode 100644 index b37b3c8..0000000 --- a/patches/patches/21_errors.patch +++ /dev/null @@ -1,8 +0,0 @@ -12c12 -< ???, ---- -> TooSmall, -29c29 -< if (???) { ---- -> if (number_error == MyNumberError.TooSmall) { diff --git a/patches/patches/22_errors2.patch b/patches/patches/22_errors2.patch deleted file mode 100644 index 0501159..0000000 --- a/patches/patches/22_errors2.patch +++ /dev/null @@ -1,4 +0,0 @@ -22c22 -< var my_number: ??? = 5; ---- -> var my_number: MyNumberError!u8 = 5; diff --git a/patches/patches/23_errors3.patch b/patches/patches/23_errors3.patch deleted file mode 100644 index a850116..0000000 --- a/patches/patches/23_errors3.patch +++ /dev/null @@ -1,8 +0,0 @@ -15c15 -< var b: u32 = addTwenty(4) ??? 22; ---- -> var b: u32 = addTwenty(4) catch 22; -22c22 -< fn addTwenty(n: u32) ??? { ---- -> fn addTwenty(n: u32) MyNumberError!u32 { diff --git a/patches/patches/24_errors4.patch b/patches/patches/24_errors4.patch deleted file mode 100644 index bb3fc8f..0000000 --- a/patches/patches/24_errors4.patch +++ /dev/null @@ -1,10 +0,0 @@ -62c62,68 -< return detectProblems(n) ??? ---- -> return detectProblems(n) catch |err| { -> if (err == MyNumberError.TooSmall) { -> return 10; -> } -> -> return err; -> }; diff --git a/patches/patches/25_errors5.patch b/patches/patches/25_errors5.patch deleted file mode 100644 index 8aa59d4..0000000 --- a/patches/patches/25_errors5.patch +++ /dev/null @@ -1,4 +0,0 @@ -29c29 -< var x = detect(n); ---- -> var x = try detect(n); diff --git a/patches/patches/26_hello2.patch b/patches/patches/26_hello2.patch deleted file mode 100644 index 0065da5..0000000 --- a/patches/patches/26_hello2.patch +++ /dev/null @@ -1,4 +0,0 @@ -22c22 -< stdout.print("Hello world!\n", .{}); ---- -> try stdout.print("Hello world!\n", .{}); diff --git a/patches/patches/27_defer.patch b/patches/patches/27_defer.patch deleted file mode 100644 index 6ff7f98..0000000 --- a/patches/patches/27_defer.patch +++ /dev/null @@ -1,4 +0,0 @@ -23c23 -< std.debug.print("Two\n", .{}); ---- -> defer std.debug.print("Two\n", .{}); diff --git a/patches/patches/28_defer2.patch b/patches/patches/28_defer2.patch deleted file mode 100644 index c042c45..0000000 --- a/patches/patches/28_defer2.patch +++ /dev/null @@ -1,4 +0,0 @@ -21c21 -< std.debug.print(") ", .{}); // <---- how!? ---- -> defer std.debug.print(") ", .{}); // <---- how!? diff --git a/patches/patches/29_errdefer.patch b/patches/patches/29_errdefer.patch deleted file mode 100644 index f93c56f..0000000 --- a/patches/patches/29_errdefer.patch +++ /dev/null @@ -1,4 +0,0 @@ -35c34 -< std.debug.print("failed!\n", .{}); ---- -> errdefer std.debug.print("failed!\n", .{}); diff --git a/patches/patches/30_switch.patch b/patches/patches/30_switch.patch deleted file mode 100644 index 05cbe1a..0000000 --- a/patches/patches/30_switch.patch +++ /dev/null @@ -1,2 +0,0 @@ -48a49 -> else => std.debug.print("?", .{}), diff --git a/patches/patches/31_switch2.patch b/patches/patches/31_switch2.patch deleted file mode 100644 index f786762..0000000 --- a/patches/patches/31_switch2.patch +++ /dev/null @@ -1,2 +0,0 @@ -33a34 -> else => '!', diff --git a/patches/patches/32_unreachable.patch b/patches/patches/32_unreachable.patch deleted file mode 100644 index 0883932..0000000 --- a/patches/patches/32_unreachable.patch +++ /dev/null @@ -1,2 +0,0 @@ -37a38 -> else => unreachable, diff --git a/patches/patches/33_iferror.patch b/patches/patches/33_iferror.patch deleted file mode 100644 index 62904db..0000000 --- a/patches/patches/33_iferror.patch +++ /dev/null @@ -1,2 +0,0 @@ -36a37 -> MyNumberError.TooSmall => std.debug.print("<4. ", .{}), diff --git a/patches/patches/34_quiz4.patch b/patches/patches/34_quiz4.patch deleted file mode 100644 index b259352..0000000 --- a/patches/patches/34_quiz4.patch +++ /dev/null @@ -1,8 +0,0 @@ -12c12 -< pub fn main() void { ---- -> pub fn main() !void { -15c15 -< const my_num: u32 = getNumber(); ---- -> const my_num: u32 = try getNumber(); diff --git a/patches/patches/35_enums.patch b/patches/patches/35_enums.patch deleted file mode 100644 index ed2344b..0000000 --- a/patches/patches/35_enums.patch +++ /dev/null @@ -1,4 +0,0 @@ -23c23 -< const Ops = enum { ??? }; ---- -> const Ops = enum { dec, inc, pow }; diff --git a/patches/patches/36_enums2.patch b/patches/patches/36_enums2.patch deleted file mode 100644 index 54a7094..0000000 --- a/patches/patches/36_enums2.patch +++ /dev/null @@ -1,12 +0,0 @@ -32c32 -< blue = ???, ---- -> blue = 0x0000ff, -54c54 -< \\ Blue ---- -> \\ Blue -59c59 -< @enumToInt(???), // Oops! We're missing something! ---- -> @enumToInt(Color.blue), // Oops! We're missing something! diff --git a/patches/patches/37_structs.patch b/patches/patches/37_structs.patch deleted file mode 100644 index c26510d..0000000 --- a/patches/patches/37_structs.patch +++ /dev/null @@ -1,4 +0,0 @@ -38a39 -> health: u8, -46a48 -> .health = 100, diff --git a/patches/patches/38_structs2.patch b/patches/patches/38_structs2.patch deleted file mode 100644 index 5d0d188..0000000 --- a/patches/patches/38_structs2.patch +++ /dev/null @@ -1,7 +0,0 @@ -44a45,50 -> chars[1] = Character{ -> .class = Class.bard, -> .gold = 10, -> .health = 100, -> .experience = 20, -> }; diff --git a/patches/patches/39_pointers.patch b/patches/patches/39_pointers.patch deleted file mode 100644 index 57d67e5..0000000 --- a/patches/patches/39_pointers.patch +++ /dev/null @@ -1,4 +0,0 @@ -33c33 -< num2 = ???; ---- -> num2 = num1_pointer.*; diff --git a/patches/patches/40_pointers2.patch b/patches/patches/40_pointers2.patch deleted file mode 100644 index a69cb20..0000000 --- a/patches/patches/40_pointers2.patch +++ /dev/null @@ -1,4 +0,0 @@ -24c24 -< const b: *u8 = &a; // fix this! ---- -> const b: *const u8 = &a; // fix this! diff --git a/patches/patches/41_pointers3.patch b/patches/patches/41_pointers3.patch deleted file mode 100644 index 02f7744..0000000 --- a/patches/patches/41_pointers3.patch +++ /dev/null @@ -1,4 +0,0 @@ -34c34 -< ??? p: ??? = undefined; ---- -> var p: *u8 = undefined; diff --git a/patches/patches/42_pointers4.patch b/patches/patches/42_pointers4.patch deleted file mode 100644 index 29ca2d0..0000000 --- a/patches/patches/42_pointers4.patch +++ /dev/null @@ -1,4 +0,0 @@ -31c31 -< ??? = 5; // fix me! ---- -> x.* = 5; // fix me! diff --git a/patches/patches/43_pointers5.patch b/patches/patches/43_pointers5.patch deleted file mode 100644 index 8a73551..0000000 --- a/patches/patches/43_pointers5.patch +++ /dev/null @@ -1,4 +0,0 @@ -60c60 -< printCharacter(???); ---- -> printCharacter(&glorp); diff --git a/patches/patches/44_quiz5.patch b/patches/patches/44_quiz5.patch deleted file mode 100644 index 44d4451..0000000 --- a/patches/patches/44_quiz5.patch +++ /dev/null @@ -1,4 +0,0 @@ -21a22 -> var elephantB = Elephant{ .letter = 'B' }; -27a29 -> elephantB.tail = &elephantC; diff --git a/patches/patches/45_optionals.patch b/patches/patches/45_optionals.patch deleted file mode 100644 index c945b5a..0000000 --- a/patches/patches/45_optionals.patch +++ /dev/null @@ -1,4 +0,0 @@ -32c32 -< var answer: u8 = result; ---- -> var answer: u8 = result orelse 42; diff --git a/patches/patches/46_optionals2.patch b/patches/patches/46_optionals2.patch deleted file mode 100644 index 10705d9..0000000 --- a/patches/patches/46_optionals2.patch +++ /dev/null @@ -1,21 +0,0 @@ -8,19d7 -< // We also introduce the handy ".?" shortcut: -< // -< // const foo = bar.?; -< // -< // is the same as -< // -< // const foo = bar orelse unreachable; -< // -< // See if you can find where we use this shortcut below. -< // -< // Now let's make those elephant tails optional! -< // -24c12 -< tail: *Elephant = null, // Hmm... tail needs something... ---- -> tail: ?*Elephant = null, // <---- make this optional! -54c42 -< if (e.tail == null) ???; ---- -> if (e.tail == null) break; diff --git a/patches/patches/47_methods.patch b/patches/patches/47_methods.patch deleted file mode 100644 index cde93af..0000000 --- a/patches/patches/47_methods.patch +++ /dev/null @@ -1,4 +0,0 @@ -84c84 -< ???.zap(heat_ray_strength); ---- -> alien.zap(heat_ray_strength); diff --git a/patches/patches/48_methods2.patch b/patches/patches/48_methods2.patch deleted file mode 100644 index 781a99e..0000000 --- a/patches/patches/48_methods2.patch +++ /dev/null @@ -1,4 +0,0 @@ -57c57 -< e = e.???; // Which method do we want here? ---- -> e = e.getTail(); // Which method do we want here? diff --git a/patches/patches/49_quiz6.patch b/patches/patches/49_quiz6.patch deleted file mode 100644 index 83f9faf..0000000 --- a/patches/patches/49_quiz6.patch +++ /dev/null @@ -1,11 +0,0 @@ -28a29,31 -> pub fn getTrunk(self: *Elephant) *Elephant { -> return self.trunk.?; -> } -30,31c33,35 -< ??? -< ---- -> pub fn hasTrunk(self: *Elephant) bool { -> return (self.trunk != null); -> } diff --git a/patches/patches/50_no_value.patch b/patches/patches/50_no_value.patch deleted file mode 100644 index 79db0a3..0000000 --- a/patches/patches/50_no_value.patch +++ /dev/null @@ -1,14 +0,0 @@ -68c68 -< var first_line1: *const [16]u8 = ???; ---- -> var first_line1: *const [16]u8 = undefined; -71c71 -< var first_line2: Err!*const [21]u8 = ???; ---- -> var first_line2: Err!*const [21]u8 = Err.Cthulhu; -79,80c79,80 -< fn printSecondLine() ??? { -< var second_line2: ?*const [18]u8 = ???; ---- -> fn printSecondLine() void { -> var second_line2: ?*const [18]u8 = null; diff --git a/patches/patches/51_values.patch b/patches/patches/51_values.patch deleted file mode 100644 index 43d1f65..0000000 --- a/patches/patches/51_values.patch +++ /dev/null @@ -1,12 +0,0 @@ -96c96 -< const print = ???; ---- -> const print = std.debug.print; -152c152 -< levelUp(glorp, reward_xp); ---- -> levelUp(&glorp, reward_xp); -157c157 -< fn levelUp(character_access: Character, xp: u32) void { ---- -> fn levelUp(character_access: *Character, xp: u32) void { diff --git a/patches/patches/52_slices.patch b/patches/patches/52_slices.patch deleted file mode 100644 index 80f8d72..0000000 --- a/patches/patches/52_slices.patch +++ /dev/null @@ -1,10 +0,0 @@ -34,35c34,35 -< const hand1: []u8 = cards[???]; -< const hand2: []u8 = cards[???]; ---- -> const hand1: []u8 = cards[0..4]; -> const hand2: []u8 = cards[4..]; -45c45 -< fn printHand(hand: ???) void { ---- -> fn printHand(hand: []u8) void { diff --git a/patches/patches/53_slices2.patch b/patches/patches/53_slices2.patch deleted file mode 100644 index f5403a2..0000000 --- a/patches/patches/53_slices2.patch +++ /dev/null @@ -1,20 +0,0 @@ -20,22c20,22 -< const base1: []u8 = scrambled[15..23]; -< const base2: []u8 = scrambled[6..10]; -< const base3: []u8 = scrambled[32..]; ---- -> const base1: []const u8 = scrambled[15..23]; -> const base2: []const u8 = scrambled[6..10]; -> const base3: []const u8 = scrambled[32..]; -25,27c25,27 -< const justice1: []u8 = scrambled[11..14]; -< const justice2: []u8 = scrambled[0..5]; -< const justice3: []u8 = scrambled[24..31]; ---- -> const justice1: []const u8 = scrambled[11..14]; -> const justice2: []const u8 = scrambled[0..5]; -> const justice3: []const u8 = scrambled[24..31]; -33c33 -< fn printPhrase(part1: []u8, part2: []u8, part3: []u8) void { ---- -> fn printPhrase(part1: []const u8, part2: []const u8, part3: []const u8) void { diff --git a/patches/patches/54_manypointers.patch b/patches/patches/54_manypointers.patch deleted file mode 100644 index 82824e8..0000000 --- a/patches/patches/54_manypointers.patch +++ /dev/null @@ -1,4 +0,0 @@ -33c33 -< const zen12_string: []const u8 = zen_manyptr; ---- -> const zen12_string: []const u8 = zen_manyptr[0..21]; diff --git a/patches/patches/55_unions.patch b/patches/patches/55_unions.patch deleted file mode 100644 index c362f20..0000000 --- a/patches/patches/55_unions.patch +++ /dev/null @@ -1,6 +0,0 @@ -62,63c62,63 -< printInsect(ant, AntOrBee.c); -< printInsect(bee, AntOrBee.c); ---- -> printInsect(ant, AntOrBee.a); -> printInsect(bee, AntOrBee.b); diff --git a/patches/patches/56_unions2.patch b/patches/patches/56_unions2.patch deleted file mode 100644 index 7341f7a..0000000 --- a/patches/patches/56_unions2.patch +++ /dev/null @@ -1,10 +0,0 @@ -47,48c47,48 -< printInsect(???); -< printInsect(???); ---- -> printInsect(ant); -> printInsect(bee); -54c54 -< switch (???) { ---- -> switch (insect) { diff --git a/patches/patches/57_unions3.patch b/patches/patches/57_unions3.patch deleted file mode 100644 index 17e27a2..0000000 --- a/patches/patches/57_unions3.patch +++ /dev/null @@ -1,4 +0,0 @@ -18c18 -< const Insect = union(InsectStat) { ---- -> const Insect = union(enum) { -- cgit v1.2.3-ZIG