mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-11-09 11:40:46 -05:00
Add remaining patch files
This commit is contained in:
parent
238beb4a2d
commit
bbe93b1f12
43 changed files with 263 additions and 43 deletions
|
@ -1 +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;
|
||||
|
|
|
@ -1 +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;
|
||||
|
|
|
@ -1 +1,8 @@
|
|||
|
||||
23c23
|
||||
< const leet = ???;
|
||||
---
|
||||
> const leet = le ++ et;
|
||||
28c28
|
||||
< const bit_pattern = [_]u8{ ??? } ** 3;
|
||||
---
|
||||
> const bit_pattern = [_]u8{ 1, 0, 0, 1 } ** 3;
|
||||
|
|
|
@ -1 +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;
|
||||
|
|
|
@ -1 +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
|
||||
|
|
|
@ -1 +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];
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
26c26
|
||||
< if (foo) {
|
||||
---
|
||||
> if (foo == 1) {
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
13c13
|
||||
< var price: u8 = if ???;
|
||||
---
|
||||
> var price: u8 = if (discount) 17 else 20;
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
24c24
|
||||
< while (???) {
|
||||
---
|
||||
> while (n < 1024) {
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
28c28
|
||||
< while (n < 1000) : ??? {
|
||||
---
|
||||
> while (n < 1000) : (n *= 2) {
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
|
||||
27,28c27,28
|
||||
< if (n % 3 == 0) ???;
|
||||
< if (n % 5 == 0) ???;
|
||||
---
|
||||
> if (n % 3 == 0) continue;
|
||||
> if (n % 5 == 0) continue;
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
21c21
|
||||
< if (???) ???;
|
||||
---
|
||||
> if (n == 4) break;
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
18c18
|
||||
< for (???) |???| {
|
||||
---
|
||||
> for (story) |scene| {
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
27c27
|
||||
< for (bits) |bit, ???| {
|
||||
---
|
||||
> for (bits) |bit, i| {
|
||||
|
|
|
@ -1 +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});
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
31c31
|
||||
< ??? deepThought() ??? {
|
||||
---
|
||||
> fn deepThought() u8 {
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
25c25
|
||||
< fn twoToThe(???) u32 {
|
||||
---
|
||||
> fn twoToThe(my_number: u32) u32 {
|
||||
|
|
|
@ -1 +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;
|
||||
|
|
|
@ -1 +1,8 @@
|
|||
|
||||
12c12
|
||||
< ???,
|
||||
---
|
||||
> TooSmall,
|
||||
29c29
|
||||
< if (???) {
|
||||
---
|
||||
> if (number_error == MyNumberError.TooSmall) {
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
22c22
|
||||
< var my_number: ??? = 5;
|
||||
---
|
||||
> var my_number: MyNumberError!u8 = 5;
|
||||
|
|
|
@ -1 +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 {
|
||||
|
|
|
@ -1 +1,10 @@
|
|||
|
||||
62c62,68
|
||||
< return detectProblems(n) ???
|
||||
---
|
||||
> return detectProblems(n) catch |err| {
|
||||
> if (err == MyNumberError.TooSmall) {
|
||||
> return 10;
|
||||
> }
|
||||
>
|
||||
> return err;
|
||||
> };
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
29c29
|
||||
< var x = detect(n);
|
||||
---
|
||||
> var x = try detect(n);
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
22c22
|
||||
< stdout.print("Hello world!\n", .{});
|
||||
---
|
||||
> try stdout.print("Hello world!\n", .{});
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
23c23
|
||||
< std.debug.print("Two\n", .{});
|
||||
---
|
||||
> defer std.debug.print("Two\n", .{});
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
21c21
|
||||
< std.debug.print(") ", .{}); // <---- how!?
|
||||
---
|
||||
> defer std.debug.print(") ", .{}); // <---- how!?
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
35c34
|
||||
< std.debug.print("failed!\n", .{});
|
||||
---
|
||||
> errdefer std.debug.print("failed!\n", .{});
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
|
||||
48a49
|
||||
> else => std.debug.print("?", .{}),
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
|
||||
33a34
|
||||
> else => '!',
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
|
||||
37a38
|
||||
> else => unreachable,
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
|
||||
36a37
|
||||
> MyNumberError.TooSmall => std.debug.print("<4. ", .{}),
|
||||
|
|
|
@ -1 +1,8 @@
|
|||
|
||||
12c12
|
||||
< pub fn main() void {
|
||||
---
|
||||
> pub fn main() !void {
|
||||
15c15
|
||||
< const my_num: u32 = getNumber();
|
||||
---
|
||||
> const my_num: u32 = try getNumber();
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
23c23
|
||||
< const Ops = enum { ??? };
|
||||
---
|
||||
> const Ops = enum { dec, inc, pow };
|
||||
|
|
|
@ -1 +1,12 @@
|
|||
|
||||
32c32
|
||||
< blue = ???,
|
||||
---
|
||||
> blue = 0x0000ff,
|
||||
54c54
|
||||
< \\ <span style="color: #{}">Blue</span>
|
||||
---
|
||||
> \\ <span style="color: #{x:0>6}">Blue</span>
|
||||
59c59
|
||||
< @enumToInt(???), // Oops! We're missing something!
|
||||
---
|
||||
> @enumToInt(Color.blue), // Oops! We're missing something!
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
38a39
|
||||
> health: u8,
|
||||
46a48
|
||||
> .health = 100,
|
||||
|
|
|
@ -1 +1,7 @@
|
|||
|
||||
44a45,50
|
||||
> chars[1] = Character{
|
||||
> .class = Class.bard,
|
||||
> .gold = 10,
|
||||
> .health = 100,
|
||||
> .experience = 20,
|
||||
> };
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
33c33
|
||||
< num2 = ???;
|
||||
---
|
||||
> num2 = num1_pointer.*;
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
24c24
|
||||
< const b: *u8 = &a; // fix this!
|
||||
---
|
||||
> const b: *const u8 = &a; // fix this!
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
34c34
|
||||
< ??? p: ??? = undefined;
|
||||
---
|
||||
> var p: *u8 = undefined;
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
31c31
|
||||
< ??? = 5; // fix me!
|
||||
---
|
||||
> x.* = 5; // fix me!
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
60c60
|
||||
< printCharacter(???);
|
||||
---
|
||||
> printCharacter(&glorp);
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
21a22
|
||||
> var elephantB = Elephant{ .letter = 'B' };
|
||||
27a29
|
||||
> elephantB.tail = &elephantC;
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
|
||||
32c32
|
||||
< var answer: u8 = result;
|
||||
---
|
||||
> var answer: u8 = result orelse 42;
|
||||
|
|
Loading…
Reference in a new issue