Skip to content

Commit 11d62d4

Browse files
committed
chore: minor stylistic changes
1 parent c399a17 commit 11d62d4

File tree

15 files changed

+36
-33
lines changed

15 files changed

+36
-33
lines changed

Builders/Builders how it works/task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ tr {
1515
}
1616
```
1717

18-
**'td' is:**
18+
**`td` is:**
1919

2020
a. a special built-in syntactic construct
2121

@@ -38,7 +38,7 @@ tr (color = "yellow") {
3838
}
3939
```
4040

41-
**'color' is:**
41+
**`color` is:**
4242

4343
a. a new variable declaration
4444

Builders/Function literals with receiver/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
Learn about [function literals with receiver](https://kotlinlang.org/docs/lambdas.html#function-literals-with-receiver).
44

5-
You can declare `isEven` and `isOdd` as values, that can be called as extension functions.
5+
You can declare `isEven` and `isOdd` as values that can be called as extension functions.
66
Complete the declarations in the code.

Builders/Html builders/task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## HTML builder
22

3-
_1._ Fill the table with proper values from the product list.
3+
1. Fill the table with proper values from the product list.
44
The products are declared in `data.kt`.
55

6-
_2._ Color the table like a chess board.
6+
2. Color the table like a chessboard.
77
Use the `getTitleColor()` and `getCellColor()` functions.
88
Pass a color as an argument to the functions `tr`, `td`.
99

Builders/String and map builders/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ val s = buildString {
2020
s == "Numbers: 123"
2121
```
2222

23-
Implement the function `buildMutableMap` that takes a parameter (of extension function type) creates a new `HashMap`,
23+
Implement the function `buildMutableMap` that takes a parameter (of extension function type), creates a new `HashMap`,
2424
builds it, and returns it as a result. Note that starting from 1.3.70, the standard library has a similiar `buildMap`
2525
function.

Builders/The function apply/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The previous examples can be rewritten using the library function
44
[`apply`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/apply.html).
5-
Write your own implementation of this function named `myApply`.
5+
Write your implementation of this function named `myApply`.
66

77
Learn about the other [scope functions](https://kotlinlang.org/docs/scope-functions.html)
88
and how to use them.

Collections/All Any and other predicates/task.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ Implement the following functions using
88
[`any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/any.html),
99
[`count`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/count.html),
1010
[`find`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/find.html):
11-
- `checkAllCustomersAreFrom` should return true if all customers are from a given city
12-
- `hasCustomerFrom` should check if there is at least one customer from a given city
13-
- `countCustomersFrom` should return the number of customers from a given city
14-
- `findCustomerFrom` should return a customer who lives in a given city, or `null` if there is none
11+
12+
* `checkAllCustomersAreFrom` should return true if all customers are from a given city
13+
* `hasCustomerFrom` should check if there is at least one customer from a given city
14+
* `countCustomersFrom` should return the number of customers from a given city
15+
* `findCustomerFrom` should return a customer who lives in a given city, or `null` if there is none
1516

1617
```kotlin
1718
val numbers = listOf(-1, 0, 2)

Collections/Associate/task.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Implement the following functions using
66
[`associateWith`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/associate-with.html),
77
and [`associate`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/associate.html):
88

9-
- Build a map from the customer name to the customer
10-
- Build a map from the customer to their city
11-
- Build a map from the customer name to their city
9+
* Build a map from the customer name to the customer
10+
* Build a map from the customer to their city
11+
* Build a map from the customer name to their city
1212

1313
```kotlin
1414
val list = listOf("abc", "cdef")

Collections/Compound tasks/task.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
## Compound tasks
22

33
Implement two functions:
4-
- The first one should find the most expensive product among all the *delivered* products
5-
ordered by the customer. Use `Order.isDelivered` flag.
64

7-
- The second one should count the amount of times a product was ordered.
8-
Note that a customer may order the same product several times.
5+
* The first one should find the most expensive product among all the *delivered* products
6+
ordered by the customer. Use `Order.isDelivered` flag
7+
* The second one should count the number of times a product was ordered. Note that a customer may order the same product
8+
several times
99

1010
Use the functions from the Kotlin standard library that were previously discussed.
1111

Collections/Filter map/task.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
## Filter; map
22

3-
Learn about [mapping](https://kotlinlang.org/docs/collection-transformations.html#mapping) and
4-
[filtering](https://kotlinlang.org/docs/collection-filtering.html#filtering-by-predicate) a collection.
3+
Learn about [mapping](https://kotlinlang.org/docs/collection-transformations.html#map) and
4+
[filtering](https://kotlinlang.org/docs/collection-filtering.html#filter-by-predicate) a collection.
55

66
Implement the following extension functions
77
using the
88
[`map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/map.html) and
99
[`filter`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/filter.html)
1010
functions:
11-
- Find all the different cities the customers are from.
12-
- Find the customers living in a given city.
11+
12+
* Find all the different cities the customers are from
13+
* Find the customers living in a given city
1314

1415
```kotlin
1516
val numbers = listOf(1, -1, 2)

Collections/FlatMap/task.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
Learn about [flattening](https://kotlinlang.org/docs/collection-transformations.html#flatten)
44
and implement two functions using
55
[`flatMap`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/flat-map.html):
6-
- The first should return all products the given customer has ordered
7-
- The second should return all products that were ordered by at least one customer
6+
7+
* The first should return all products the given customer has ordered
8+
* The second should return all products that at least one customer ordered
89

910
```kotlin
1011
val result = listOf("abc", "12")

Collections/Fold/task.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
## Fold
22

33
Learn about [fold and reduce](https://kotlinlang.org/docs/collection-aggregate.html#fold-and-reduce)
4-
and implement a function that returns the set of products that were ordered by all the customers using
5-
[`fold`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/fold.html).
4+
and implement a function that returns the set of products that all the customers ordered using [`fold`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/fold.html).
65

7-
You can use the `Customer.getOrderedProducts()` which was defined in the previous task
8-
(copy its implementation).
6+
You can use the `Customer.getOrderedProducts()` defined in the previous task (copy its implementation).
97

108
```kotlin
119
listOf(1, 2, 3, 4)

Collections/Getting used to new style/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Getting used to new style
1+
## Getting used to the new style
22

33
We can rewrite and simplify the following code using lambdas and operations on collections.
44
Fill in the gaps in `doSomethingWithCollection`,

Collections/Max min/task.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
Learn about [collection aggregate operations](https://kotlinlang.org/docs/collection-aggregate.html).
44

55
Implement two functions:
6-
- the first should return the customer who has placed the most amount of orders in this shop
7-
- the second should return the most expensive product that has been ordered by the given customer
6+
7+
* The first should return the customer who has placed the most amount of orders in this shop
8+
* The second should return the most expensive product that the given customer has ordered
89

910
The functions
1011
[`maxOrNull`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/max-or-null.html),
@@ -19,6 +20,6 @@ listOf("a", "ab").minByOrNull(String::length) == "a"
1920
```
2021

2122
You can use [callable references](https://kotlinlang.org/docs/lambdas.html#instantiating-a-function-type)
22-
instead of lambdas. This can be especially helpful in call chains, where
23+
instead of lambdas. It can be especially helpful in call chains, where
2324
`it` occurs in different lambdas and has different types.
2425
Implement the `getMostExpensiveProductBy` function using callable references.

Collections/Sequences/task.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
Learn about [sequences](https://kotlinlang.org/docs/sequences.html),
44
they allow you to perform operations lazily rather than eagerly.
5+
56
Copy the implementation from the previous task and modify it in a way
67
that the operations on sequences are used.

Generics/Generic functions/task.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ a collection into two collections according to the predicate.
66

77
There is a [`partition()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/partition.html)
88
function in the standard library that always returns two newly created lists.
9-
You should write a function that splits the collection into two collections given as arguments.
9+
Write a function that splits the collection into two collections given as arguments.
1010
The signature of the
1111
[`toCollection()`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/to-collection.html)
1212
function from the standard library might help you.

0 commit comments

Comments
 (0)