From bf04adf0915be1ea2c7eae1d2981726d55c4fea8 Mon Sep 17 00:00:00 2001 From: tovedetered Date: Sat, 4 May 2024 13:29:42 -0400 Subject: [PATCH] fixing typos and grammar --- exercises/093_hello_c.zig | 6 +++--- exercises/096_memory_allocation.zig | 2 +- exercises/097_bit_manipulation.zig | 14 +++++++------- exercises/098_bit_manipulation2.zig | 12 ++++++------ exercises/099_formatting.zig | 6 +++--- exercises/100_for4.zig | 6 +++--- exercises/102_testing.zig | 10 +++++----- exercises/103_tokenization.zig | 9 +++++---- exercises/104_threading.zig | 4 ++-- exercises/105_threading2.zig | 4 ++-- 10 files changed, 37 insertions(+), 36 deletions(-) diff --git a/exercises/093_hello_c.zig b/exercises/093_hello_c.zig index 182e0b0..a00e3a8 100644 --- a/exercises/093_hello_c.zig +++ b/exercises/093_hello_c.zig @@ -1,16 +1,16 @@ // // When Andrew Kelley announced the idea of a new programming language // - namely Zig - in his blog on February 8, 2016, he also immediately -// stated his ambitious goal: to replace the C language! +// stated this ambitious goal: to replace the C language! // // In order to be able to achieve this goal at all, Zig should be // as compatible as possible with its "predecessor". // Only if it is possible to exchange individual modules in existing -// C programs without having to use complicated wrappers, +// C programs without having to use any complicated wrappers, // the undertaking has a chance of success. // // So it is not surprising that calling C functions and vice versa -// is extremely "smooth". +// is extremely smooth. // // To call C functions in Zig, you only need to specify the library // that contains said function. For this purpose there is a built-in diff --git a/exercises/096_memory_allocation.zig b/exercises/096_memory_allocation.zig index 1ece922..ed7053c 100644 --- a/exercises/096_memory_allocation.zig +++ b/exercises/096_memory_allocation.zig @@ -31,7 +31,7 @@ // } // Instead of a simple integer or a constant sized slice, this -// program requires a slice to be allocated that is the same size as +// program requires a slice to be allocated so that is the same size as // an input array. // Given a series of numbers, take the running average. In other diff --git a/exercises/097_bit_manipulation.zig b/exercises/097_bit_manipulation.zig index 424fb4c..5ad42de 100644 --- a/exercises/097_bit_manipulation.zig +++ b/exercises/097_bit_manipulation.zig @@ -1,5 +1,5 @@ // -// Bit manipulations is a very powerful tool just also from Zig. +// Bit manipulation is a very powerful tool that Zig also supports. // Since the dawn of the computer age, numerous algorithms have been // developed that solve tasks solely by moving, setting, or logically // combining bits. @@ -8,9 +8,9 @@ // functions where possible. And it is often possible with calculations // based on integers. // -// Often it is not easy to understand at first glance what exactly these +// Often it is not easy to understand at first glance exactly what these // algorithms do when only "numbers" in memory areas change outwardly. -// But it must never be forgotten that the numbers only represent the +// But it cannot be forgotten that the numbers only represent the // interpretation of the bit sequences. // // Quasi the reversed case we have otherwise, namely that we represent @@ -35,8 +35,8 @@ // const res5 = numOne ^ numTwo; // = 1111 1010 - xor // // -// To familiarize ourselves with bit manipulation, we start with a simple -// but often underestimated function and then add other exercises in +// To familiarize ourselves with bit manipulation, let's start with a simple +// but often underestimated function and then add other exercises in a // loose order. // // The following text contains excerpts from Wikipedia. @@ -63,8 +63,8 @@ // y := temp // // However, with integers we can also achieve the swap function simply by -// bit manipulation. To do this, the variables are mutually linked with xor -// and the result is the same. +// using bit manipulation. To do this, the variables are mutually linked with +// xor and the result is the same. const std = @import("std"); const print = std.debug.print; diff --git a/exercises/098_bit_manipulation2.zig b/exercises/098_bit_manipulation2.zig index 9abb14c..c408982 100644 --- a/exercises/098_bit_manipulation2.zig +++ b/exercises/098_bit_manipulation2.zig @@ -1,5 +1,5 @@ // -// Another useful practice for bit manipulation is setting bits as flags. +// Another useful application for bit manipulation is setting bits as flags. // This is especially useful when processing lists of something and storing // the states of the entries, e.g. a list of numbers and for each prime // number a flag is set. @@ -19,12 +19,12 @@ // For example, you could take an array of bool and set the value to 'true' // for each letter in the order of the alphabet (a=0; b=1; etc.) found in // the sentence. However, this is neither memory efficient nor particularly -// fast. Instead we take a simpler way, very similar in principle, we define -// a variable with at least 26 bits (e.g. u32) and also set the bit for each -// letter found at the corresponding position. +// fast. Instead we can take a simpler path, one that is +// very similar in principle. We define a variable with at least 26 bits (e.g. u32) \ +// and also set the bit for each letter found at the corresponding position. // -// Zig provides functions for this in the standard library, but we prefer to -// solve it without these extras, after all we want to learn something. +// Zig provides functions for this in the standard library, but we should +// solve it without these extras; After all we want to learn something. // const std = @import("std"); const ascii = std.ascii; diff --git a/exercises/099_formatting.zig b/exercises/099_formatting.zig index 07af3ba..c797e1a 100644 --- a/exercises/099_formatting.zig +++ b/exercises/099_formatting.zig @@ -19,9 +19,9 @@ // https://github.com/ziglang/zig/blob/master/lib/std/fmt.zig#L29 // // Zig already has a very nice selection of formatting options. -// These can be used in different ways, but typically to convert -// numerical values into various text representations. The -// results can be used for direct output to a terminal or stored +// These can be used in different ways, but they are typically used +// to convert numerical values into various text representations. +// The results can be used for direct output to a terminal or stored // for later use or written to a file. The latter is useful when // large amounts of data are to be processed by other programs. // diff --git a/exercises/100_for4.zig b/exercises/100_for4.zig index e0fa602..7343b41 100644 --- a/exercises/100_for4.zig +++ b/exercises/100_for4.zig @@ -1,13 +1,13 @@ // -// We've seen that the 'for' loop can let us perform some action +// We've seen that the 'for' loop can let us perform an action // for every item in an array or slice. // // More recently, we discovered that it supports ranges to // iterate over number sequences. // // This is part of a more general capability of the `for` loop: -// looping over one or more "objects" where an object is an -// array, slice, or range. +// looping over one or more "objects" where an object is defined as +// an array, slice, or range. // // In fact, we *did* use multiple objects way back in Exercise // 016 where we iterated over an array and also a numeric index. diff --git a/exercises/102_testing.zig b/exercises/102_testing.zig index 89a0ee8..dfa3ae1 100644 --- a/exercises/102_testing.zig +++ b/exercises/102_testing.zig @@ -1,12 +1,12 @@ // // A big advantage of Zig is the integration of its own test system. // This allows the philosophy of Test Driven Development (TDD) to be -// implemented perfectly. Zig even goes one step further than other -// languages, the tests can be included directly in the source file. +// implemented easily. Zig even goes one step further than other +// languages, in that the tests can be included directly in the source file. // // This has several advantages. On the one hand it is much clearer to -// have everything in one file, both the source code and the associated -// test code. On the other hand, it is much easier for third parties +// have both the source code and the associated test code in one file. +// On the other hand, it is much easier for third parties // to understand what exactly a function is supposed to do if they can // simply look at the test inside the source and compare both. // @@ -16,7 +16,7 @@ // illustrate it with a small example including a test. // // Therefore, in this exercise we will deal with the basics of testing -// in Zig. Basically, tests work as follows: you pass certain parameters +// in Zig. Tests work as follows: you pass certain parameters // to a function, for which you get a return - the result. This is then // compared with the EXPECTED value. If both values match, the test is // passed, otherwise an error message is displayed. diff --git a/exercises/103_tokenization.zig b/exercises/103_tokenization.zig index eded880..c384c3e 100644 --- a/exercises/103_tokenization.zig +++ b/exercises/103_tokenization.zig @@ -1,20 +1,21 @@ // // The functionality of the standard library is becoming increasingly -// important in Zig. First of all, it is helpful to take a look at how +// important to Zig. First of all, it is helpful to take a look at how // the individual functions are implemented. Because this is wonderfully // suitable as a template for your own functions. In addition these -// standard functions are part of the basic configuration of Zig. +// standard functions are part of the basic configuration and capabilities +// of Zig. // // This means that they are always available on every system. // Therefore it is worthwhile to deal with them also in Ziglings. -// It's a great way to learn important skills. For example, it is +// It's also a great way to learn important skills. For example, it's // often necessary to process large amounts of data from files. // And for this sequential reading and processing, Zig provides some // useful functions, which we will take a closer look at in the coming // exercises. // // A nice example of this has been published on the Zig homepage, -// replacing the somewhat dusty 'Hello world! +// replacing the somewhat dusty 'Hello world!' // // Nothing against 'Hello world!', but it just doesn't do justice // to the elegance of Zig and that's a pity, if someone takes a short, diff --git a/exercises/104_threading.zig b/exercises/104_threading.zig index ac40b3c..9c4e216 100644 --- a/exercises/104_threading.zig +++ b/exercises/104_threading.zig @@ -4,8 +4,8 @@ // one possibility, namely asynchronous processes, in Exercises 84-91. // // However, the computing power of the processor is only distributed to -// the started tasks, which always reaches its limits when pure computing -// power is called up. +// the started and running tasks, which always reaches its limits when +// pure computing power is called up. // // For example, in blockchains based on proof of work, the miners have // to find a nonce for a certain character string so that the first m bits diff --git a/exercises/105_threading2.zig b/exercises/105_threading2.zig index c85f801..8a773a7 100644 --- a/exercises/105_threading2.zig +++ b/exercises/105_threading2.zig @@ -1,6 +1,6 @@ // -// Now that we are familiar with the principles of multi threading, we -// boldly venture into a practical example from mathematics. +// Now that we are familiar with the principles of multi-threading, we +// shall boldly venture into a practical example from mathematics. // We will determine the circle number PI with sufficient accuracy. // // There are different methods for this, and some of them are several