Browse Source

Manually cleaned up patches/patches for issue #73

Patches cleaned and fixed by hand as proof of my devotion. <3
Dave Gauer 3 years ago
parent
commit
f6d1b36be2

+ 2 - 2
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;

+ 3 - 3
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;

+ 1 - 1
patches/patches/009_if.patch

@@ -1,4 +1,4 @@
-26c26
+27c27
 <     if (foo) {
 ---
 >     if (foo == 1) {

+ 1 - 1
patches/patches/018_functions.patch

@@ -1,4 +1,4 @@
-31c31
+28c28
 < ??? deepThought() ??? {
 ---
 > fn deepThought() u8 {

+ 0 - 13
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...
 ---

+ 1 - 1
patches/patches/047_methods.patch

@@ -1,4 +1,4 @@
-84c84
+87c87
 <             ???.zap(heat_ray_strength);
 ---
 >             alien.zap(heat_ray_strength);

+ 3 - 20
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".

+ 0 - 42
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;
 <     };

+ 2 - 18
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) {

+ 0 - 4
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,

+ 0 - 4
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.???,