aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--patches/patches/005_arrays2.patch4
-rw-r--r--patches/patches/006_strings.patch6
-rw-r--r--patches/patches/009_if.patch2
-rw-r--r--patches/patches/018_functions.patch2
-rw-r--r--patches/patches/046_optionals2.patch13
-rw-r--r--patches/patches/047_methods.patch2
-rw-r--r--patches/patches/058_quiz7.patch23
-rw-r--r--patches/patches/063_labels.patch42
-rw-r--r--patches/patches/076_sentinels.patch20
-rw-r--r--patches/patches/081_anonymous_structs2.patch4
-rw-r--r--patches/patches/082_anonymous_structs3.patch4
11 files changed, 13 insertions, 109 deletions
diff --git a/patches/patches/005_arrays2.patch b/patches/patches/005_arrays2.patch
index 1e7b6b1..83e71e0 100644
--- a/patches/patches/005_arrays2.patch
+++ b/patches/patches/005_arrays2.patch
@@ -1,8 +1,8 @@
-23c23
+28c28
< const leet = ???;
---
> const leet = le ++ et;
-28c28
+33c33
< 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
index 7e7465c..3ed9ea6 100644
--- a/patches/patches/006_strings.patch
+++ b/patches/patches/006_strings.patch
@@ -1,12 +1,12 @@
-25c25
+27c27
< const d: u8 = ziggy[???];
---
> const d: u8 = ziggy[4];
-29c29
+31c31
< const laugh = "ha " ???;
---
> const laugh = "ha " ** 3;
-36c36
+38c38
< const major_tom = major ??? tom;
---
> const major_tom = major ++ " " ++ tom;
diff --git a/patches/patches/009_if.patch b/patches/patches/009_if.patch
index 46579ad..0b00183 100644
--- a/patches/patches/009_if.patch
+++ b/patches/patches/009_if.patch
@@ -1,4 +1,4 @@
-26c26
+27c27
< if (foo) {
---
> if (foo == 1) {
diff --git a/patches/patches/018_functions.patch b/patches/patches/018_functions.patch
index dd3f2f6..1083a1a 100644
--- a/patches/patches/018_functions.patch
+++ b/patches/patches/018_functions.patch
@@ -1,4 +1,4 @@
-31c31
+28c28
< ??? deepThought() ??? {
---
> fn deepThought() u8 {
diff --git a/patches/patches/046_optionals2.patch b/patches/patches/046_optionals2.patch
index 10705d9..8437cdc 100644
--- a/patches/patches/046_optionals2.patch
+++ b/patches/patches/046_optionals2.patch
@@ -1,16 +1,3 @@
-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...
---
diff --git a/patches/patches/047_methods.patch b/patches/patches/047_methods.patch
index cde93af..81e733b 100644
--- a/patches/patches/047_methods.patch
+++ b/patches/patches/047_methods.patch
@@ -1,4 +1,4 @@
-84c84
+87c87
< ???.zap(heat_ray_strength);
---
> alien.zap(heat_ray_strength);
diff --git a/patches/patches/058_quiz7.patch b/patches/patches/058_quiz7.patch
index a4e3bbb..ac21352 100644
--- a/patches/patches/058_quiz7.patch
+++ b/patches/patches/058_quiz7.patch
@@ -1,31 +1,14 @@
-185,186c185,186
+195,196c195,196
< .place => print("{s}", .{p.name}),
< .path => print("--{}->", .{p.dist}),
---
> .place => |p| print("{s}", .{p.name}),
> .path => |p| print("--{}->", .{p.dist}),
-248c248
+258c258
< if (place == entry.*.?.place) return entry;
---
> if (place == entry.*.?.place) return &entry.*.?;
-302c302
+312c312
< fn getTripTo(self: *HermitsNotebook, trip: []?TripItem, dest: *Place) void {
---
> fn getTripTo(self: *HermitsNotebook, trip: []?TripItem, dest: *Place) TripError!void {
-336d335
-< // Note: you do not need to fix anything here.
-419,422c418
-< // We convert the usize length to a u8 with @intCast(), a
-< // builtin function just like @import(). We'll learn about
-< // these properly in a later exercise.
-< var i: u8 = @intCast(u8, trip.len);
----
-> var i: u8 = @intCast(u8, trip.len); // convert usize length
-449,452c445,446
-< // Search" (BFS).
-< //
-< // By tracking "lowest cost" paths, we can also say that we're
-< // performing a "least-cost search".
----
-> // Search" (BFS). By tracking "lowest cost" paths, we can also say
-> // that we're performing a "least-cost search".
diff --git a/patches/patches/063_labels.patch b/patches/patches/063_labels.patch
index aba02a4..42ef9ea 100644
--- a/patches/patches/063_labels.patch
+++ b/patches/patches/063_labels.patch
@@ -1,45 +1,3 @@
-20c20
-< // statement. Does that mean you can return a value from any
----
-> // statement. Does that mean you can return a value from any
-28,30c28,30
-< // Labels can also be used with loops. Being able to break out of
-< // nested loops at a specific level is one of those things that
-< // you won't use every day, but when the time comes, it's
----
-> // And all of that also applies to loops. Being able to break out
-> // of nested loops at a specific level is one of those things
-> // that you won't use every day, but when the time comes, it's
-32,33c32
-< // inner loop is sometimes so handy, it almost feels like cheating
-< // (and can help you avoid creating a lot of temporary variables).
----
-> // inner loop is is almost too beautiful to look at directly:
-41,44c40,44
-< // In the above example, the break exits from the outer loop
-< // labeled "two_loop" and returns the value 2. The else clause is
-< // attached to the outer two_loop and would be evaluated if the
-< // loop somehow ended without the break having been called.
----
-> // The break exits from the outer loop labeled "two_loop" and
-> // returns the value 2. The else clause is attached to the outer
-> // two_loop and would be evaluated if the loop somehow ended
-> // without the break having been called. (Impossible in this
-> // case.)
-55,56c55,56
-< // As mentioned before, we'll soon understand why these two
-< // numbers don't need explicit types. Hang in there!
----
-> // As mentioned before, we'll soon understand why these numbers
-> // don't need explicit types. Hang in there!
-100c100
-< // numbers (based on array position) will be fine for our
----
-> // numbers (based on array position!) will be fine for our
-108c108
-< // Now look at each required ingredient for the Food...
----
-> // Now look at each required ingredient for the food...
131,132c131,132
< break;
< };
diff --git a/patches/patches/076_sentinels.patch b/patches/patches/076_sentinels.patch
index ccc8622..3cf4877 100644
--- a/patches/patches/076_sentinels.patch
+++ b/patches/patches/076_sentinels.patch
@@ -1,24 +1,8 @@
-38,40d37
-< // Important: the sentinel value must be of the same type as the
-< // data being terminated!
-< //
-56c53
-< // numbers that both ends in and CONTAINS the sentinel value.
----
-> // numbers that both ends in and CONTAINS the sentinal value.
-62,63c59,62
-< // the sentinel 0 in the middle. The many-item pointer stops
-< // at the first sentinel value.)
----
-> // the sentinel 0 in the middle. The many-item pointer must
-> // stop at the first sentinel value. The difference is simply
-> // that arrays have a known length and many-item pointers
-> // don't.)
-84c83
+85c84
< for (???) |s| {
---
> for (my_seq) |s| {
-96c95
+97c96
< while (??? != my_sentinel) {
---
> while (my_seq[i] != my_sentinel) {
diff --git a/patches/patches/081_anonymous_structs2.patch b/patches/patches/081_anonymous_structs2.patch
index b9890d6..a9ca689 100644
--- a/patches/patches/081_anonymous_structs2.patch
+++ b/patches/patches/081_anonymous_structs2.patch
@@ -2,7 +2,3 @@
< fn printCircle(???) void {
---
> fn printCircle(circle: anytype) void {
-44c44
-< circle.centaur_y,
----
-> circle.center_y,
diff --git a/patches/patches/082_anonymous_structs3.patch b/patches/patches/082_anonymous_structs3.patch
index 807e2f9..bb4a6f2 100644
--- a/patches/patches/082_anonymous_structs3.patch
+++ b/patches/patches/082_anonymous_structs3.patch
@@ -6,10 +6,6 @@
< for (fields) |field| {
---
> inline for (fields) |field| {
-116c116
-< // @field(foo, "x"); // returns the value at foo.x
----
-> // @field(foo, "x");
120,122c120,122
< field.???,
< field.???,