From c18ad7883259435cc61045e38129d61b39daca6c Mon Sep 17 00:00:00 2001 From: Fergus Baker Date: Sat, 17 Sep 2022 19:27:13 +0100 Subject: [PATCH 01/14] typo and type fixes in comment --- exercises/082_anonymous_structs3.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/082_anonymous_structs3.zig b/exercises/082_anonymous_structs3.zig index 8344321..e5c6839 100644 --- a/exercises/082_anonymous_structs3.zig +++ b/exercises/082_anonymous_structs3.zig @@ -4,8 +4,8 @@ // // .{ // false, -// @as(u32, 15); -// @as(i64, 67.12); +// @as(u32, 15), +// @as(f64, 67.12) // } // // We call these "tuples", which is a term used by many From f2a4209f6d6b39e148e3e47aa3237ae02c8cadb8 Mon Sep 17 00:00:00 2001 From: Kim SHrier Date: Mon, 7 Nov 2022 00:28:40 -0700 Subject: [PATCH 02/14] Exercise 60: mention new float type f80 --- exercises/060_floats.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/060_floats.zig b/exercises/060_floats.zig index a223257..237e9c6 100644 --- a/exercises/060_floats.zig +++ b/exercises/060_floats.zig @@ -1,7 +1,7 @@ // // Zig has support for IEEE-754 floating-point numbers in these -// specific sizes: f16, f32, f64, f128. Floating point literals -// may be writen in scientific notation: +// specific sizes: f16, f32, f64, f80, and f128. Floating point +// literals may be writen in scientific notation: // // const a1: f32 = 1200.0; // 1,200 // const a2: f32 = 1.2e+3; // 1,200 From e6ef5e619195e87e26a6c99d3a2162950eefdb51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ertu=C4=9Frul=20=C3=96zdemir?= <45506003+phantom32-0@users.noreply.github.com> Date: Tue, 15 Nov 2022 12:09:42 +0000 Subject: [PATCH 03/14] fix minor typo in contributing.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index be8c511..21b98ac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ Ziglings is intended for programmers of all experience levels. No specific language knowledge is expected. Anyone who can install the current Zig snapshot, setup a copy of Ziglings, and knows common language building blocks (if/then/else, loops, and -functions) is ready or Ziglings. +functions) is ready for Ziglings. Ziglings is intended to be completely self-contained. If you can't solve an exercise from the information you've gleaned so From b08233eafe2985a2890a47c52e431c63521ff381 Mon Sep 17 00:00:00 2001 From: Leandro Motta Barros Date: Thu, 29 Dec 2022 21:17:40 -0300 Subject: [PATCH 04/14] Fix typo: "written", not "writen" --- exercises/060_floats.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/060_floats.zig b/exercises/060_floats.zig index a223257..e13a216 100644 --- a/exercises/060_floats.zig +++ b/exercises/060_floats.zig @@ -1,7 +1,7 @@ // // Zig has support for IEEE-754 floating-point numbers in these // specific sizes: f16, f32, f64, f128. Floating point literals -// may be writen in scientific notation: +// may be written in scientific notation: // // const a1: f32 = 1200.0; // 1,200 // const a2: f32 = 1.2e+3; // 1,200 From 1891030f4980410d13a26ff1a15e8097448802be Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Thu, 12 Jan 2023 19:25:06 +0100 Subject: [PATCH 05/14] Update 042_pointers4.zig https://github.com/ratfactor/ziglings/pull/122 --- exercises/042_pointers4.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/042_pointers4.zig b/exercises/042_pointers4.zig index 359a2f1..1f6db70 100644 --- a/exercises/042_pointers4.zig +++ b/exercises/042_pointers4.zig @@ -17,7 +17,7 @@ pub fn main() void { var num: u8 = 1; var more_nums = [_]u8{ 1, 1, 1, 1 }; - // Let's pass a reference to num to our function and print it: + // Let's pass the num reference to our function and print it: makeFive(&num); std.debug.print("num: {}, ", .{num}); From 8b8d2a6caab51012c27673743643b31c9f7b7539 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Thu, 12 Jan 2023 20:10:46 +0100 Subject: [PATCH 06/14] Update README.md Added action item for interfaces --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5a82e26..737f58d 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,7 @@ Core Language * [x] Quoted identifiers @"" * [x] Anonymous structs/tuples/lists * [ ] Async <--- IN PROGRESS! +* [ ] Interfaces ## Contributing From 543d0ba585c8f61ed24f64d41b0e776e7c597455 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Sat, 14 Jan 2023 12:25:57 +0100 Subject: [PATCH 07/14] fixed https://github.com/ratfactor/ziglings/issues/156 --- exercises/064_builtins.zig | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/exercises/064_builtins.zig b/exercises/064_builtins.zig index 1a0d263..85d1aa7 100644 --- a/exercises/064_builtins.zig +++ b/exercises/064_builtins.zig @@ -38,14 +38,12 @@ pub fn main() void { // Let's try it with a tiny 4-bit integer size to make it clear: const a: u4 = 0b1101; const b: u4 = 0b0101; - var my_result: u4 = undefined; - var overflowed: bool = undefined; - overflowed = @addWithOverflow(u4, a, b, &my_result); + const my_result = @addWithOverflow(a, b); // Check out our fancy formatting! b:0>4 means, "print // as a binary number, zero-pad right-aligned four digits." // The print() below will produce: "1101 + 0101 = 0010 (true)". - print("{b:0>4} + {b:0>4} = {b:0>4} ({})", .{ a, b, my_result, overflowed }); + print("{b:0>4} + {b:0>4} = {b:0>4} ({s})", .{ a, b, my_result[0], if (my_result[1] == 1) "true" else "false" }); // Let's make sense of this answer. The value of 'b' in decimal is 5. // Let's add 5 to 'a' but go one by one and see where it overflows: From 029839cb834fdb89cb76768ab0b3451150df59e3 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Sat, 14 Jan 2023 12:56:52 +0100 Subject: [PATCH 08/14] update readme for new ziglang version --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 737f58d..2f946de 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,8 @@ $ zig build The Zig language is under very active development. In order to be current, Ziglings tracks **development** builds of the Zig compiler rather than -versioned **release** builds. The last stable release was `0.9.1`, but Ziglings -needs a dev build with pre-release version "0.10.0" and a build number at least +versioned **release** builds. The last stable release was `0.10.0`, but Ziglings +needs a dev build with pre-release version "0.11.0" and a build number at least as high as that shown in the example version check above. It is likely that you'll download a build which is _greater_ than the minimum. @@ -81,6 +81,8 @@ about input: ### Version Changes +Version-0.11.0-dev.1302+d813cef42 +* *2023-01-14* zig 0.11.0-dev.1302 - changes in `@addWithOverflow` in builtin functions * *2022-09-09* zig 0.10.0-dev.3978 - change in `NativeTargetInfo.detect` in build * *2022-09-06* zig 0.10.0-dev.3880 - Ex 074 correctly fails again: comptime array len * *2022-08-29* zig 0.10.0-dev.3685 - `@typeName()` output change, stage1 req. for async From 27b783201614065ca3ea38a79f890b5639f6ad08 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Sat, 14 Jan 2023 13:12:24 +0100 Subject: [PATCH 09/14] entered current zig version number --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f946de..5dd88e4 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Verify the installation and build number of `zig` like so: ```bash $ zig version -0.10.0-dev.3978+xxxxxxxxx +0.11.0-dev.1302+xxxxxxxxx ``` Clone this repository with Git: From f0d43f488f434c1df2f5395d2b8afc35b15d1797 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Sat, 14 Jan 2023 15:36:36 +0100 Subject: [PATCH 10/14] patch because of a change in @typeInfo --- exercises/065_builtins2.zig | 2 +- exercises/071_comptime6.zig | 2 +- exercises/082_anonymous_structs3.zig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/065_builtins2.zig b/exercises/065_builtins2.zig index a0f9160..7d3e770 100644 --- a/exercises/065_builtins2.zig +++ b/exercises/065_builtins2.zig @@ -100,7 +100,7 @@ pub fn main() void { // // pub const StructField = struct { // name: []const u8, - // field_type: type, + // type: type, // default_value: anytype, // is_comptime: bool, // alignment: comptime_int, diff --git a/exercises/071_comptime6.zig b/exercises/071_comptime6.zig index f764590..7723291 100644 --- a/exercises/071_comptime6.zig +++ b/exercises/071_comptime6.zig @@ -41,7 +41,7 @@ pub fn main() void { const fields = @typeInfo(Narcissus).Struct.fields; ??? { - if (field.field_type != void) { + if (field.type != void) { print(" {s}", .{field.name}); } } diff --git a/exercises/082_anonymous_structs3.zig b/exercises/082_anonymous_structs3.zig index e5c6839..6760ff3 100644 --- a/exercises/082_anonymous_structs3.zig +++ b/exercises/082_anonymous_structs3.zig @@ -96,7 +96,7 @@ fn printTuple(tuple: anytype) void { // // pub const StructField = struct { // name: []const u8, - // field_type: type, + // type: type, // default_value: anytype, // is_comptime: bool, // alignment: comptime_int, From bfb1d95a1fa22c2859fda60c8d526156d5d580e4 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Sat, 14 Jan 2023 16:02:16 +0100 Subject: [PATCH 11/14] changes from @typeInfo in Readme noted --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5dd88e4..ba5f03c 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ about input: ### Version Changes Version-0.11.0-dev.1302+d813cef42 -* *2023-01-14* zig 0.11.0-dev.1302 - changes in `@addWithOverflow` in builtin functions +* *2023-01-14* zig 0.11.0-dev.1302 - changes in `@addWithOverflow` (now returns a tuple) and `@typeInfo` * *2022-09-09* zig 0.10.0-dev.3978 - change in `NativeTargetInfo.detect` in build * *2022-09-06* zig 0.10.0-dev.3880 - Ex 074 correctly fails again: comptime array len * *2022-08-29* zig 0.10.0-dev.3685 - `@typeName()` output change, stage1 req. for async From d59c3e95983a83c65b549bf41500206681233ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Fro=C5=82ow?= Date: Tue, 17 Jan 2023 23:24:32 +0100 Subject: [PATCH 12/14] writen -> written --- exercises/060_floats.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/060_floats.zig b/exercises/060_floats.zig index 237e9c6..8ba51db 100644 --- a/exercises/060_floats.zig +++ b/exercises/060_floats.zig @@ -1,7 +1,7 @@ // // Zig has support for IEEE-754 floating-point numbers in these // specific sizes: f16, f32, f64, f80, and f128. Floating point -// literals may be writen in scientific notation: +// literals may be written in scientific notation: // // const a1: f32 = 1200.0; // 1,200 // const a2: f32 = 1.2e+3; // 1,200 From 22289d6ad1f1c23c2fe393fed2d3a67147c6197e Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Sat, 21 Jan 2023 13:57:32 +0100 Subject: [PATCH 13/14] disable the async excercises because of temporary not available in zig compiler --- build.zig | 90 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/build.zig b/build.zig index 1cfa098..59ec8a1 100644 --- a/build.zig +++ b/build.zig @@ -418,47 +418,48 @@ const exercises = [_]Exercise{ .main_file = "083_anonymous_lists.zig", .output = "I say hello!", }, - .{ - .main_file = "084_async.zig", - .output = "foo() A", - .hint = "Read the facts. Use the facts.", - .@"async" = true, - }, - .{ - .main_file = "085_async2.zig", - .output = "Hello async!", - .@"async" = true, - }, - .{ - .main_file = "086_async3.zig", - .output = "5 4 3 2 1", - .@"async" = true, - }, - .{ - .main_file = "087_async4.zig", - .output = "1 2 3 4 5", - .@"async" = true, - }, - .{ - .main_file = "088_async5.zig", - .output = "Example Title.", - .@"async" = true, - }, - .{ - .main_file = "089_async6.zig", - .output = ".com: Example Title, .org: Example Title.", - .@"async" = true, - }, - .{ - .main_file = "090_async7.zig", - .output = "beef? BEEF!", - .@"async" = true, - }, - .{ - .main_file = "091_async8.zig", - .output = "ABCDEF", - .@"async" = true, - }, + // disabled because of https://github.com/ratfactor/ziglings/issues/163 + // .{ + // .main_file = "084_async.zig", + // .output = "foo() A", + // .hint = "Read the facts. Use the facts.", + // .@"async" = true, + // }, + // .{ + // .main_file = "085_async2.zig", + // .output = "Hello async!", + // .@"async" = true, + // }, + // .{ + // .main_file = "086_async3.zig", + // .output = "5 4 3 2 1", + // .@"async" = true, + // }, + // .{ + // .main_file = "087_async4.zig", + // .output = "1 2 3 4 5", + // .@"async" = true, + // }, + // .{ + // .main_file = "088_async5.zig", + // .output = "Example Title.", + // .@"async" = true, + // }, + // .{ + // .main_file = "089_async6.zig", + // .output = ".com: Example Title, .org: Example Title.", + // .@"async" = true, + // }, + // .{ + // .main_file = "090_async7.zig", + // .output = "beef? BEEF!", + // .@"async" = true, + // }, + // .{ + // .main_file = "091_async8.zig", + // .output = "ABCDEF", + // .@"async" = true, + // }, }; /// Check the zig version to make sure it can compile the examples properly. @@ -711,9 +712,10 @@ const ZiglingStep = struct { zig_args.append("build-exe") catch unreachable; // Enable the stage 1 compiler if using the async feature - if (self.exercise.@"async") { - zig_args.append("-fstage1") catch unreachable; - } + // disabled because of https://github.com/ratfactor/ziglings/issues/163 + // if (self.exercise.@"async") { + // zig_args.append("-fstage1") catch unreachable; + // } if (builder.color != .auto) { zig_args.append("--color") catch unreachable; From f8e960faebdbe96267a8179fca25f216e9890645 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Sat, 21 Jan 2023 14:19:48 +0100 Subject: [PATCH 14/14] added note for async functions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba5f03c..8e6445d 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ about input: ### Version Changes Version-0.11.0-dev.1302+d813cef42 -* *2023-01-14* zig 0.11.0-dev.1302 - changes in `@addWithOverflow` (now returns a tuple) and `@typeInfo` +* *2023-01-14* zig 0.11.0-dev.1302 - changes in `@addWithOverflow` (now returns a tuple) and `@typeInfo`; temporary disabled async functionality * *2022-09-09* zig 0.10.0-dev.3978 - change in `NativeTargetInfo.detect` in build * *2022-09-06* zig 0.10.0-dev.3880 - Ex 074 correctly fails again: comptime array len * *2022-08-29* zig 0.10.0-dev.3685 - `@typeName()` output change, stage1 req. for async