diff --git a/concepts/char/about.md b/concepts/char/about.md index 7b5e4930..5ab73da4 100644 --- a/concepts/char/about.md +++ b/concepts/char/about.md @@ -1,15 +1,15 @@ # Char -`Char` is a data type in Crystal that represents a 32-bit [Unicode][unicode] code point. -Their size makes so they are memory efficient, and also gives it certain properties that Strings don't have. -They are created using single quotes (`'`) and do only allow for one Unicode code point to be placed inside. +`Char` is a data type in Crystal representing a 32-bit [Unicode][unicode] code point. +Their size makes them memory efficient and gives them specific properties that Strings doesn't have. +They are created using single quotes (`'`) and only allow one Unicode code point to be placed inside. ```crystal 'a' # => 'a' 'a'.class # => Char ``` -When working with Strings in Crystal is it quite common to work with Chars, since quite a few methods in the String class return Chars or takes Chars as arguments. +It is quite common to work with Chars when working with Strings in Crystal since quite a few methods in the String class return Chars or take Chars as arguments. For example, the [`String#[]`][index] method returns a Char, or the [`String#chars`][chars] method returns a collection of Chars. ## Incrementing / Decrementing @@ -24,7 +24,7 @@ Due to char being a 32 Unicode point do they support incrementing and decrementi # => 'a' ``` -There is also a method called [`Char#succ`][succ] which will return the next char in the Unicode table and [`Char#pred`][pred] which will return the previous char in the Unicode table. +There is also a method called [`Char#succ`][succ], which returns the next char in the Unicode table, and [`Char#pred`][pred], which returns the previous char in the Unicode table. ```crystal 'a'.succ @@ -36,8 +36,8 @@ There is also a method called [`Char#succ`][succ] which will return the next cha ## concatenation -Since Chars is only meant to represent a 32-bit Unicode, can't 2 chars be concatenation. -Thereby Chars can only be concatenated with Strings. +Since Chars is only meant to represent a 32-bit Unicode, two chars can't be concatenated. +Therefore, Chars can only be concatenated with Strings. ```Crystal 'a' + "bc" @@ -49,8 +49,8 @@ Thereby Chars can only be concatenated with Strings. ## Properties methods -Crystal has a few methods that can be used to get information about a Char, like if it is a number or a letter, or if it is uppercase or lowercase. -Here is a list of some of the methods, for a full list see the [Char API][char-api]: +Crystal has a few methods for getting information about a Character, such as whether it is a number or a letter or whether it is uppercase or lowercase. +Here is a list of some of the methods, for a complete list see the [Char API][char-api]: | Method | Description | | -------------------------------- | ---------------------------------------------------- | @@ -58,14 +58,14 @@ Here is a list of some of the methods, for a full list see the [Char API][char-a | [`Char#letter?`][letter] | Returns `true` if the Char is a letter | | [`Char#lowercase?`][lowercase] | Returns `true` if the Char is lowercase | | [`Char#uppercase?`][uppercase] | Returns `true` if the Char is uppercase | -| [`Char#ascii?`][ascii] | Returns `true` if the Char is an ASCII character | +| [`Char#ascii?`][ascii] | Returns `true` if the Char is an ASCII character | | [`Char#whitespace?`][whitespace] | Returns `true` if the Char is a whitespace character | ## Converting ### Converting between code points and Chars -Since Chars is a 32-bit Unicode point, so can you convert between Chars and code points (Int). +Since Chars is a 32-bit Unicode point, can you convert between Chars and code points (Int). This can be done using the [`Char#ord`][ord] method which will return the code point of the Char, or the [`Int#chr`][chr] method which will return the Char of the code point. ```crystal @@ -78,8 +78,8 @@ This can be done using the [`Char#ord`][ord] method which will return the code p ### Converting between types -As with other data types so does Chars have a few methods that can be used to convert between types. -The most common one is the `Char#to_s` method which will convert the Char to a String, but there is also the `Char#to_i` method which will convert the Char to an Int, And the `Char#to_f` method which will convert the Char to a Float. +As with other data types, chars have a few methods for converting between types. +The most common one is the `Char#to_s` method, which converts the Char to a String. However, there is also the `Char#to_i` method, which converts the Char to an Int, and the `Char#to_f` method, which converts the Char to a Float. ```crystal 'a'.to_s @@ -94,8 +94,8 @@ The most common one is the `Char#to_s` method which will convert the Char to a S ## Escaping -As with Strings are certain characters that can't be written directly, and to write them you need to escape them. -To write an escape sequence you can use the `\` character followed by the character you want to escape. +As with Strings, there are certain characters that can't be written directly, and to write them, you need to escape them. +You can use the `\` character to write an escape sequence followed by the character you want to escape. These are the special characters in Crystal: diff --git a/concepts/char/introduction.md b/concepts/char/introduction.md index c5bc5605..fcbf6af5 100644 --- a/concepts/char/introduction.md +++ b/concepts/char/introduction.md @@ -1,15 +1,15 @@ # Char -`Char` is a data type in Crystal that represents a 32-bit [Unicode][unicode] code point. -Their size makes so they are memory efficient, and also gives it certain properties that Strings don't have. -They are created using single quotes (`'`) and do only allow for one Unicode code point to be placed inside. +`Char` is a data type in Crystal representing a 32-bit [Unicode][unicode] code point. +Their size makes them memory efficient and gives them specific properties that Strings doesn't have. +They are created using single quotes (`'`) and only allow one Unicode code point to be placed inside. ```crystal 'a' # => 'a' 'a'.class # => Char ``` -When working with Strings in Crystal is it quite common to work with Chars, since quite a few methods in the String class return Chars or takes Chars as arguments. +It is quite common to work with Chars when working with Strings in Crystal since quite a few methods in the String class return Chars or take Chars as arguments. For example, the [`String#[]`][index] method returns a Char, or the [`String#chars`][chars] method returns a collection of Chars. ## Incrementing / Decrementing @@ -24,7 +24,7 @@ Due to char being a 32 Unicode point do they support incrementing and decrementi # => 'a' ``` -There is also a method called [`Char#succ`][succ] which will return the next char in the Unicode table and [`Char#pred`][pred] which will return the previous char in the Unicode table. +There is also a method called [`Char#succ`][succ], which returns the next char in the Unicode table, and [`Char#pred`][pred], which returns the previous char in the Unicode table. ```crystal 'a'.succ @@ -36,8 +36,8 @@ There is also a method called [`Char#succ`][succ] which will return the next cha ## concatenation -Since Chars is only meant to represent a 32-bit Unicode, can't 2 chars be concatenation. -Thereby Chars can only be concatenated with Strings. +Since Chars is only meant to represent a 32-bit Unicode, two chars can't be concatenated. +Therefore, Chars can only be concatenated with Strings. ```Crystal 'a' + "bc" @@ -49,8 +49,8 @@ Thereby Chars can only be concatenated with Strings. ## Properties methods -Crystal has a few methods that can be used to get information about a Char, like if it is a number or a letter, or if it is uppercase or lowercase. -Here is a list of some of the methods, for a full list see the [Char API][char-api]: +Crystal has a few methods for getting information about a Character, such as whether it is a number or a letter or whether it is uppercase or lowercase. +Here is a list of some of the methods, for a complete list see the [Char API][char-api]: | Method | Description | | -------------------------------- | ---------------------------------------------------- | @@ -58,14 +58,14 @@ Here is a list of some of the methods, for a full list see the [Char API][char-a | [`Char#letter?`][letter] | Returns `true` if the Char is a letter | | [`Char#lowercase?`][lowercase] | Returns `true` if the Char is lowercase | | [`Char#uppercase?`][uppercase] | Returns `true` if the Char is uppercase | -| [`Char#ascii?`][ascii] | Returns `true` if the Char is an ASCII character | +| [`Char#ascii?`][ascii] | Returns `true` if the Char is an ASCII character | | [`Char#whitespace?`][whitespace] | Returns `true` if the Char is a whitespace character | ## Converting ### Converting between code points and Chars -Since Chars is a 32-bit Unicode point, so can you convert between Chars and code points (Int). +Since Chars is a 32-bit Unicode point, can you convert between Chars and code points (Int). This can be done using the [`Char#ord`][ord] method which will return the code point of the Char, or the [`Int#chr`][chr] method which will return the Char of the code point. ```crystal @@ -78,8 +78,8 @@ This can be done using the [`Char#ord`][ord] method which will return the code p ### Converting between types -As with other data types so does Chars have a few methods that can be used to convert between types. -The most common one is the `Char#to_s` method which will convert the Char to a String, but there is also the `Char#to_i` method which will convert the Char to an Int, And the `Char#to_f` method which will convert the Char to a Float. +As with other data types, chars have a few methods for converting between types. +The most common one is the `Char#to_s` method, which converts the Char to a String. However, there is also the `Char#to_i` method, which converts the Char to an Int, and the `Char#to_f` method, which converts the Char to a Float. ```crystal 'a'.to_s diff --git a/exercises/concept/library-of-luton/.docs/instructions.md b/exercises/concept/library-of-luton/.docs/instructions.md index 77fd340c..1f6b717b 100644 --- a/exercises/concept/library-of-luton/.docs/instructions.md +++ b/exercises/concept/library-of-luton/.docs/instructions.md @@ -1,16 +1,16 @@ # Instructions -The library of Luton is a large library with a big collection of different kinds of literature varying from books to art. +The library of Luton is a large library with a large collection of literature, ranging from books to art. The library has a section where they study literature and add books to the computer system. -There are certain parts that aim to be automated and you are asked to help them with this. -This includes helping things from automating the inscribe process forms to helping decrypting texts. +Certain parts aim to be automated and you are asked to help them. +This includes helping things from automating the inscribe process forms to helping decrypt texts. ## 1. Get first letter of title -The books in a library are supposed to be easy to find and therefore they are sorted by the first letter of the book's title. +A library's books are supposed to be easy to find, so they are sorted by the first letter of the title. -Implement the `Library.first_letter` method that takes an argument `title` which holds the title of the book. +Implement the `Library.first_letter` method, which takes an argument `title`, which holds the book's title. The method should return the first letter of the title. ```Crystal @@ -20,12 +20,12 @@ Library.first_letter("Mystery of the Crystal Skull") ## 2. Get authors initials -The library has a lot of books and they are all written by different authors. -Often authors are referred to by their initials and therefore the library requested a system that gives the initials of the author, by inputting the author's first name and last name. +The library has a lot of books written by different authors. +Authors are often referred to by their initials, so the library requested a system that gives the initials of the author by inputting the author's first name and last name. The initials should be formatted as such: `{first_letter_of_first_name}.{first_letter_of_last_name}` Implement the `Library.initials` method that takes two arguments `first_name` and `last_name` which hold the first name and last name of the author. -The method should return the initials of the author. +The method should return the author's initials. ```Crystal Library.initials("William", "Shakespeare") @@ -35,14 +35,14 @@ Library.initials("William", "Shakespeare") ## 3. Decrypt letter Some literature is encrypted and the library has a lot of encrypted texts. -The library would like a new decryption system for a special kind of encryption. +The library would like a new decryption system for special encryption. The encryption works by taking the letter and replacing it with the letter preceding it in the alphabet. For example `a` becomes `z`, `b` becomes `a`, `c` becomes `b`, and so on. The library would like it to be able to decrypt both uppercase and lowercase letters and keep the same case as the original letter. -Implement the `Library.decrypt_character` method that takes an argument `character` which holds the letter to decrypt. +Implement the `Library.decrypt_character` method, which takes an argument `character`, which holds the letter to decrypt. The method should return the decrypted letter. ```Crystal @@ -52,14 +52,14 @@ Library.decrypt_character('a') ## 4. Decrypt text -The library would also like to be able to decrypt a whole text, with the encryption, that takes the preceding letter in the alphabet. +The library would also like to decrypt a whole text, with the encryption, that takes the preceding letter in the alphabet. The decrypter should only decrypt letters and leave all other characters as they are. -Implement the `Library.decrypt_text` method that takes an argument `text` which holds the text to decrypt. +Implement the `Library.decrypt_text` method, which takes an argument `text`, which holds the text to decrypt. The method should return the decrypted text. ```Crystal Library.decrypt_text("Ifmmp Xpsme!") # => "Hello World!" -``` +``` \ No newline at end of file diff --git a/exercises/concept/library-of-luton/.docs/introduction.md b/exercises/concept/library-of-luton/.docs/introduction.md index c5bc5605..fcbf6af5 100644 --- a/exercises/concept/library-of-luton/.docs/introduction.md +++ b/exercises/concept/library-of-luton/.docs/introduction.md @@ -1,15 +1,15 @@ # Char -`Char` is a data type in Crystal that represents a 32-bit [Unicode][unicode] code point. -Their size makes so they are memory efficient, and also gives it certain properties that Strings don't have. -They are created using single quotes (`'`) and do only allow for one Unicode code point to be placed inside. +`Char` is a data type in Crystal representing a 32-bit [Unicode][unicode] code point. +Their size makes them memory efficient and gives them specific properties that Strings doesn't have. +They are created using single quotes (`'`) and only allow one Unicode code point to be placed inside. ```crystal 'a' # => 'a' 'a'.class # => Char ``` -When working with Strings in Crystal is it quite common to work with Chars, since quite a few methods in the String class return Chars or takes Chars as arguments. +It is quite common to work with Chars when working with Strings in Crystal since quite a few methods in the String class return Chars or take Chars as arguments. For example, the [`String#[]`][index] method returns a Char, or the [`String#chars`][chars] method returns a collection of Chars. ## Incrementing / Decrementing @@ -24,7 +24,7 @@ Due to char being a 32 Unicode point do they support incrementing and decrementi # => 'a' ``` -There is also a method called [`Char#succ`][succ] which will return the next char in the Unicode table and [`Char#pred`][pred] which will return the previous char in the Unicode table. +There is also a method called [`Char#succ`][succ], which returns the next char in the Unicode table, and [`Char#pred`][pred], which returns the previous char in the Unicode table. ```crystal 'a'.succ @@ -36,8 +36,8 @@ There is also a method called [`Char#succ`][succ] which will return the next cha ## concatenation -Since Chars is only meant to represent a 32-bit Unicode, can't 2 chars be concatenation. -Thereby Chars can only be concatenated with Strings. +Since Chars is only meant to represent a 32-bit Unicode, two chars can't be concatenated. +Therefore, Chars can only be concatenated with Strings. ```Crystal 'a' + "bc" @@ -49,8 +49,8 @@ Thereby Chars can only be concatenated with Strings. ## Properties methods -Crystal has a few methods that can be used to get information about a Char, like if it is a number or a letter, or if it is uppercase or lowercase. -Here is a list of some of the methods, for a full list see the [Char API][char-api]: +Crystal has a few methods for getting information about a Character, such as whether it is a number or a letter or whether it is uppercase or lowercase. +Here is a list of some of the methods, for a complete list see the [Char API][char-api]: | Method | Description | | -------------------------------- | ---------------------------------------------------- | @@ -58,14 +58,14 @@ Here is a list of some of the methods, for a full list see the [Char API][char-a | [`Char#letter?`][letter] | Returns `true` if the Char is a letter | | [`Char#lowercase?`][lowercase] | Returns `true` if the Char is lowercase | | [`Char#uppercase?`][uppercase] | Returns `true` if the Char is uppercase | -| [`Char#ascii?`][ascii] | Returns `true` if the Char is an ASCII character | +| [`Char#ascii?`][ascii] | Returns `true` if the Char is an ASCII character | | [`Char#whitespace?`][whitespace] | Returns `true` if the Char is a whitespace character | ## Converting ### Converting between code points and Chars -Since Chars is a 32-bit Unicode point, so can you convert between Chars and code points (Int). +Since Chars is a 32-bit Unicode point, can you convert between Chars and code points (Int). This can be done using the [`Char#ord`][ord] method which will return the code point of the Char, or the [`Int#chr`][chr] method which will return the Char of the code point. ```crystal @@ -78,8 +78,8 @@ This can be done using the [`Char#ord`][ord] method which will return the code p ### Converting between types -As with other data types so does Chars have a few methods that can be used to convert between types. -The most common one is the `Char#to_s` method which will convert the Char to a String, but there is also the `Char#to_i` method which will convert the Char to an Int, And the `Char#to_f` method which will convert the Char to a Float. +As with other data types, chars have a few methods for converting between types. +The most common one is the `Char#to_s` method, which converts the Char to a String. However, there is also the `Char#to_i` method, which converts the Char to an Int, and the `Char#to_f` method, which converts the Char to a Float. ```crystal 'a'.to_s diff --git a/exercises/concept/library-of-luton/spec/library_of_luton_spec.cr b/exercises/concept/library-of-luton/spec/library_of_luton_spec.cr index 74d8df1f..edd8eef2 100644 --- a/exercises/concept/library-of-luton/spec/library_of_luton_spec.cr +++ b/exercises/concept/library-of-luton/spec/library_of_luton_spec.cr @@ -2,7 +2,7 @@ require "spec" require "../src/*" describe "Library" do - describe "first_letter" do + describe "first_letter", tags: "task_id=1" do it "Should return the first letter of a title" do Library.first_letter("Mystery of the Crystal Skull").should eq 'M' end @@ -16,7 +16,7 @@ describe "Library" do end end - describe "initials" do + describe "initials", tags: "task_id=2" do it "Should return the initials of a author" do Library.initials("William", "Shakespeare").should eq "W.S" end @@ -30,7 +30,7 @@ describe "Library" do end end - describe "decrypt_character" do + describe "decrypt_character", tags: "task_id=3" do it "Should return the decrypted character of 'B' character" do Library.decrypt_character('B').should eq 'A' end @@ -56,7 +56,7 @@ describe "Library" do end end - describe "decrypt_text" do + describe "decrypt_text", tags: "task_id=4" do it "Should return the decrypted text of a text" do expected = "Hello World!" Library.decrypt_text("Ifmmp Xpsme!").should eq expected