Skip to content

Commit 064782e

Browse files
committed
Use a consistent style on all blockquotes
1 parent f2c57cb commit 064782e

23 files changed

+74
-77
lines changed

Diff for: _overviews/scala3-book/collections-classes.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ As shown, `Map` and `Set` come in both immutable and mutable versions.
6363

6464
The basics of each type are demonstrated in the following sections.
6565

66-
>In Scala, a _buffer_ — such as `ArrayBuffer` and `ListBuffer` — is a sequence that can grow and shrink.
66+
> In Scala, a _buffer_ — such as `ArrayBuffer` and `ListBuffer` — is a sequence that can grow and shrink.
6767
6868

6969
### A note about immutable collections
@@ -90,9 +90,9 @@ The recommended, general-purpose, “go to” sequential collections for the com
9090
For example, if you need an immutable, indexed collection, in general you should use a `Vector`.
9191
Conversely, if you need a mutable, indexed collection, use an `ArrayBuffer`.
9292

93-
>`List` and `Vector` are often used when writing code in a functional style.
94-
`ArrayBuffer` is commonly used when writing code in a mutable style.
95-
`ListBuffer` is used when you’re mixing styles, such as building a list.
93+
> `List` and `Vector` are often used when writing code in a functional style.
94+
> `ArrayBuffer` is commonly used when writing code in a mutable style.
95+
> `ListBuffer` is used when you’re mixing styles, such as building a list.
9696
9797
The next several sections briefly demonstrate the `List`, `Vector`, and `ArrayBuffer` types.
9898

@@ -149,7 +149,7 @@ val c = List(-1, 0) ::: a // List(-1, 0, 1, 2, 3)
149149
You can also _append_ elements to a `List`, but because `List` is a singly-linked list, you should generally only prepend elements to it;
150150
appending elements to it is a relatively slow operation, especially when you work with large sequences.
151151

152-
>Tip: If you want to prepend and append elements to an immutable sequence, use `Vector` instead.
152+
> Tip: If you want to prepend and append elements to an immutable sequence, use `Vector` instead.
153153
154154
Because `List` is a linked-list, you shouldn’t try to access the elements of large lists by their index value.
155155
For instance, if you have a `List` with one million elements in it, accessing an element like `myList(999_999)` will take a relatively long time, because that request has to traverse all those elements.
@@ -297,7 +297,7 @@ val c = Vector(-1, 0) ++: a // Vector(-1, 0, 1, 2, 3)
297297

298298
In addition to fast random access and updates, `Vector` provides fast append and prepend times, so you can use these features as desired.
299299

300-
>See the [Collections Performance Characteristics](https://docs.scala-lang.org/overviews/collections-2.13/performance-characteristics.html) for performance details about `Vector` and other collections.
300+
> See the [Collections Performance Characteristics](https://docs.scala-lang.org/overviews/collections-2.13/performance-characteristics.html) for performance details about `Vector` and other collections.
301301
302302
Finally, you use a `Vector` in a `for` loop just like a `List`, `ArrayBuffer`, or any other sequence:
303303

Diff for: _overviews/scala3-book/collections-methods.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Instead, only some of the most commonly-used methods are shown, including:
2626

2727
The following methods work on all of the sequence types, including `List`, `Vector`, `ArrayBuffer`, etc., but these examples use a `List` unless otherwise specified.
2828

29-
>As a very important note, none of the methods on `List` mutate the list.
30-
They all work in a functional style, meaning that they return a new collection with the modified results.
29+
> As a very important note, none of the methods on `List` mutate the list.
30+
> They all work in a functional style, meaning that they return a new collection with the modified results.
3131
3232

3333

@@ -402,7 +402,7 @@ scala> a.reduce(_ * _)
402402
res1: Int = 24
403403
```
404404

405-
>An important concept to know about `reduce` is that — as its name implies — it’s used to _reduce_ a collection down to a single value.
405+
> An important concept to know about `reduce` is that — as its name implies — it’s used to _reduce_ a collection down to a single value.
406406
407407

408408

@@ -411,9 +411,9 @@ res1: Int = 24
411411
There are literally dozens of additional methods on the Scala collections types that will keep you from ever needing to write another `for` loop.
412412
See the Reference documentation for more details and examples.
413413

414-
>As a final note, if you’re using Java code in a Scala project, you can convert Java collections to Scala collections.
415-
By doing this you can use those collections in `for` expressions, and can also take advantage of Scala’s functional collections methods.
416-
See the [Interacting with Java][interacting] section for more details.
414+
> As a final note, if you’re using Java code in a Scala project, you can convert Java collections to Scala collections.
415+
> By doing this you can use those collections in `for` expressions, and can also take advantage of Scala’s functional collections methods.
416+
> See the [Interacting with Java][interacting] section for more details.
417417
418418

419419

Diff for: _overviews/scala3-book/concurrency.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ When you want to write parallel and concurrent applications in Scala, you _can_
1616

1717
Here’s a description of the Scala `Future` from its Scaladoc:
1818

19-
>“A `Future` represents a value which may or may not _currently_ be available, but will be available at some point, or an exception if that value could not be made available.”
19+
> “A `Future` represents a value which may or may not _currently_ be available, but will be available at some point, or an exception if that value could not be made available.”
2020
2121
To demonstrate what that means, let’s first look at single-threaded programming.
2222
In the single-threaded world you bind the result of a method call to a variable like this:
@@ -53,9 +53,9 @@ Conversely, if `aShortRunningTask` is created as a `Future`, the `println` state
5353
In this chapter you’ll see how to use futures, including how to run multiple futures in parallel and combine their results in a `for` expression.
5454
You’ll also see examples of methods that are used to handle the value in a future once it returns.
5555

56-
>When you think about futures, it’s important to know that they’re intended as a one-shot, “Handle this relatively slow computation on some other thread, and call me back with a result when you’re done” construct.
57-
As a point of contrast, [Akka](https://akka.io) actors are intended to run for a long time and respond to many requests during their lifetime.
58-
While an actor may live forever, a future is intended to be run only once.
56+
> When you think about futures, it’s important to know that they’re intended as a one-shot, “Handle this relatively slow computation on some other thread, and call me back with a result when you’re done” construct.
57+
> As a point of contrast, [Akka](https://akka.io) actors are intended to run for a long time and respond to many requests during their lifetime.
58+
> While an actor may live forever, a future is intended to be run only once.
5959
6060

6161

Diff for: _overviews/scala3-book/control-structures.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,9 @@ In this example the variable `i` is tested against the cases shown.
389389
If it’s between `0` and `6`, `day` is bound to a string that represents one of the days of the week.
390390
Otherwise, the catch-all case is represented by the `_` character, and `day` is bound to the string, `"invalid day"`.
391391

392-
>When writing simple `match` expressions like this, it’s recommended to use the `@switch` annotation on the variable `i`.
393-
This annotation provides a compile time warning if the switch can’t be compiled to a `tableswitch` or `lookupswitch`, which are better for performance.
394-
See the Reference documentation for more details.
392+
> When writing simple `match` expressions like this, it’s recommended to use the `@switch` annotation on the variable `i`.
393+
> This annotation provides a compile time warning if the switch can’t be compiled to a `tableswitch` or `lookupswitch`, which are better for performance.
394+
> See the Reference documentation for more details.
395395
396396

397397
### Using the default value

Diff for: _overviews/scala3-book/domain-modeling-fp.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ When modeling the world around us with FP, you typically use these Scala constru
1515
- Case classes
1616
- Traits
1717

18-
>If you’re not familiar with algebraic data types (ADTs) and their generalized version (GADTs), you may want to read the [Algebraic Data Types][adts] section before reading this section.
18+
> If you’re not familiar with algebraic data types (ADTs) and their generalized version (GADTs), you may want to read the [Algebraic Data Types][adts] section before reading this section.
1919
2020

2121

@@ -42,7 +42,7 @@ An FP design is implemented in a similar way:
4242
- You describe operations that work on those values (your functions)
4343

4444
> As we will see, reasoning about programs in this style is quite different from the object-oriented programming.
45-
Data in FP simply **is**:
45+
> Data in FP simply **is**:
4646
> Separating functionality from your data let's you inspect your data without having to worry about behavior.
4747
4848
In this chapter we’ll model the data and operations for a “pizza” in a pizza store.
@@ -175,7 +175,7 @@ def crustPrice(s: CrustSize, t: CrustType): Double =
175175
To compute the price of the crust we simultaneously pattern match on both the size and the type of the crust.
176176

177177
> An important point about all functions shown above is that they are *pure functions*: they do not mutate any data or have other side-effects (like throwing exceptions or writing to a file).
178-
All they do is simply receive values and compute the result.
178+
> All they do is simply receive values and compute the result.
179179
180180
## How to Organize Functionality
181181
When implementing the `pizzaPrice` function above, we did not say _where_ we would define it.
@@ -195,7 +195,7 @@ These different solutions are shown in the remainder of this section.
195195

196196
A first approach is to define the behavior — the functions — in a companion object.
197197

198-
>As discussed in the Domain Modeling [Tools section][modeling-tools], a _companion object_ is an `object` that has the same name as a class, and is declared in the same file as the class.
198+
> As discussed in the Domain Modeling [Tools section][modeling-tools], a _companion object_ is an `object` that has the same name as a class, and is declared in the same file as the class.
199199
200200
With this approach, in addition to the enumeration or case class you also define an equally named companion object that contains the behavior.
201201

@@ -284,9 +284,9 @@ val p4 = updateCrustSize(p3, Large)
284284
If that code seems okay, you’ll typically start sketching another API — such as an API for orders — but since we’re only looking at pizzas right now, we’ll stop thinking about interfaces and create a concrete implementation of this interface.
285285

286286
> Notice that this is usually a two-step process.
287-
In the first step, you sketch the contract of your API as an *interface*.
288-
In the second step you create a concrete *implementation* of that interface.
289-
In some cases you’ll end up creating multiple concrete implementations of the base interface.
287+
> In the first step, you sketch the contract of your API as an *interface*.
288+
> In the second step you create a concrete *implementation* of that interface.
289+
> In some cases you’ll end up creating multiple concrete implementations of the base interface.
290290
291291

292292
### Creating a concrete implementation

Diff for: _overviews/scala3-book/domain-modeling-tools.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,8 @@ case Teacher(name, whatTheyTeach) =>
623623
Those patterns work because `Student` and `Teacher` are defined as case classes that have `unapply` methods whose type signature conforms to a certain standard.
624624
Technically, the specific type of pattern matching shown in these examples is known as a *constructor pattern*.
625625

626-
>The Scala standard is that an `unapply` method returns the case class constructor fields in a tuple that’s wrapped in an `Option`.
627-
The “tuple” part of the solution was shown in the previous lesson.
626+
> The Scala standard is that an `unapply` method returns the case class constructor fields in a tuple that’s wrapped in an `Option`.
627+
> The “tuple” part of the solution was shown in the previous lesson.
628628
629629
To show how that code works, create an instance of `Student` and `Teacher`:
630630

@@ -643,7 +643,7 @@ scala> getPrintableString(t)
643643
res1: String = Bob Donnan teaches Mathematics.
644644
```
645645

646-
>All of this content on `unapply` methods and extractors is a little advanced for an introductory book like this, but because case classes are an important FP topic, it seems better to cover them, rather than skipping over them.
646+
> All of this content on `unapply` methods and extractors is a little advanced for an introductory book like this, but because case classes are an important FP topic, it seems better to cover them, rather than skipping over them.
647647
648648
#### Add pattern matching to any type with unapply
649649

Diff for: _overviews/scala3-book/fp-functional-error-handling.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ There are two common answers, depending on your needs:
9696
- Use a `match` expression
9797
- Use a `for` expression
9898

99-
>There are other approaches that can be used.
100-
See the [Reference documentation][reference] for details on those approaches.
99+
> There are other approaches that can be used.
100+
> See the [Reference documentation][reference] for details on those approaches.
101101
102102

103103

@@ -234,8 +234,8 @@ makeInt(x) match
234234
case None => println("That didn't work.")
235235
```
236236

237-
>There are several other ways to handle `Option` values.
238-
See the Reference documentation for more details.
237+
> There are several other ways to handle `Option` values.
238+
> See the Reference documentation for more details.
239239
{% endcomment %}
240240

241241

Diff for: _overviews/scala3-book/fp-functions-are-values.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ val lessThanFive = nums.filter(_ < 5) // List(1,2,3,4)
2222

2323
In those examples, anonymous functions are passed into `map` and `filter`.
2424

25-
>Anonymous functions are also known as *lambdas*.
25+
> Anonymous functions are also known as *lambdas*.
2626
2727
In addition to passing anonymous functions into `filter` and `map`, you can also supply them with *methods*:
2828

@@ -37,8 +37,8 @@ val doubles = nums.filter(underFive).map(double)
3737

3838
This ability to treat methods and functions as values is a powerful feature that functional programming languages provide.
3939

40-
>Technically, a a function that takes another function as an input parameter is known as a *Higher-Order Function*.
41-
(If you like humor, as someone once wrote, that’s like saying that a class that takes an instance of another class as a constructor parameter is a Higher-Order Class.)
40+
> Technically, a a function that takes another function as an input parameter is known as a *Higher-Order Function*.
41+
> (If you like humor, as someone once wrote, that’s like saying that a class that takes an instance of another class as a constructor parameter is a Higher-Order Class.)
4242
4343

4444

Diff for: _overviews/scala3-book/fp-immutable-values.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ next-page: fp-pure-functions
88
---
99

1010

11-
1211
In pure functional programming, only immutable values are used.
1312
In Scala this means:
1413

@@ -68,8 +67,8 @@ val elton = p.copy(
6867

6968
There are other techniques for working with immutable collections and variables, but hopefully these examples give you a taste of the techniques.
7069

71-
>Depending on your needs, you may create enums, traits, or classes instead of `case` classes.
72-
See the [Data Modeling][modeling] chapter for more details.
70+
> Depending on your needs, you may create enums, traits, or classes instead of `case` classes.
71+
> See the [Data Modeling][modeling] chapter for more details.
7372
7473

7574

Diff for: _overviews/scala3-book/fp-pure-functions.md

+9-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ next-page: fp-functions-are-values
88
---
99

1010

11-
1211
{% comment %}
1312
TODO: Use someone else’s definition?
1413
{% endcomment %}
@@ -41,8 +40,8 @@ These `String` methods are also pure functions:
4140

4241
Most methods on the Scala collections classes also work as pure functions, including `drop`, `filter`, `map`, and many more.
4342

44-
>In Scala, *functions* and *methods* are almost completely interchangeable, so even though we use the common industry term “pure function,” this term can be used to describe both functions and methods.
45-
If you’re interested in how methods can be used like functions, see the [Eta Expansion][eta] discussion.
43+
> In Scala, *functions* and *methods* are almost completely interchangeable, so even though we use the common industry term “pure function,” this term can be used to describe both functions and methods.
44+
> If you’re interested in how methods can be used like functions, see the [Eta Expansion][eta] discussion.
4645
4746

4847

@@ -52,9 +51,9 @@ Conversely, the following functions are *impure* because they violate the defini
5251

5352
The `foreach` method on collections classes is impure because it’s only used for its side effects, such as printing to STDOUT.
5453

55-
>A great hint that `foreach` is impure is that it’s method signature declares that it returns the type `Unit`.
56-
Because it doesn’t return anything, logically the only reason you ever call it is to achieve some side effect.
57-
Similarly, *any* method that returns `Unit` is going to be an impure function.
54+
> A great hint that `foreach` is impure is that it’s method signature declares that it returns the type `Unit`.
55+
> Because it doesn’t return anything, logically the only reason you ever call it is to achieve some side effect.
56+
> Similarly, *any* method that returns `Unit` is going to be an impure function.
5857
5958
Date and time related methods like `getDayOfWeek`, `getHour`, and `getMinute` are all impure because their output depends on something other than their input parameters.
6059
Their results rely on some form of hidden I/O; *hidden inputs,* in these examples.
@@ -74,8 +73,8 @@ In general, impure functions do one or more of these things:
7473

7574
Of course an application isn’t very useful if it can’t read or write to the outside world, so people make this recommendation:
7675

77-
>Write the core of your application using pure functions, and then write an impure “wrapper” around that core to interact with the outside world.
78-
As someone once said, this is like putting a layer of impure icing on top of a pure cake.
76+
> Write the core of your application using pure functions, and then write an impure “wrapper” around that core to interact with the outside world.
77+
> As someone once said, this is like putting a layer of impure icing on top of a pure cake.
7978
8079
It’s important to note that there are ways to make impure interactions with the outside world feel more pure.
8180
For instance, you’ll hear about using an `IO` Monad to deal with input and output.
@@ -110,8 +109,8 @@ If you understand that code, you’ll see that it meets the pure function defini
110109

111110
The first key point of this section is the definition of a pure function:
112111

113-
>A *pure function* is a function that depends only on its declared inputs and its internal algorithm to produce its output.
114-
It does not read any other values from “the outside world” — the world outside of the function’s scope — and it doesn’t modify any values in the outside world.
112+
> A *pure function* is a function that depends only on its declared inputs and its internal algorithm to produce its output.
113+
> It does not read any other values from “the outside world” — the world outside of the function’s scope — and it doesn’t modify any values in the outside world.
115114
116115
A second key point is that every real-world application interacts with the outside world.
117116
Therefore, a simplified way to think about functional programs is that they consist of a core of pure functions that are wrapped with other functions that interact with the outside world.

Diff for: _overviews/scala3-book/fun-hofs.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ As you can infer from these examples, the general syntax for defining function p
190190
variableName: (parameterTypes ...) => returnType
191191
```
192192

193-
>Because functional programming is like creating and combining a series of algebraic equations, it’s common to think about types a *lot* when designing functions and applications.
194-
You might say that you “think in types.”
193+
> Because functional programming is like creating and combining a series of algebraic equations, it’s common to think about types a *lot* when designing functions and applications.
194+
> You might say that you “think in types.”
195195
196196

197197

Diff for: _overviews/scala3-book/fun-write-map-function.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Imagine for a moment that the `List` class doesn’t have its own `map` method,
1414
A good first step when creating functions is to accurately state the problem.
1515
Focusing only on a `List[Int]`, you state:
1616

17-
>I want to write a `map` method that can be used to a function to each element in a `List[Int]` that it’s given, returning the transformed elements as a new list.
17+
> I want to write a `map` method that can be used to a function to each element in a `List[Int]` that it’s given, returning the transformed elements as a new list.
1818
1919
Given that statement, you start to write the method signature.
2020
First, you know that you want to accept a function as a parameter, and that function should transform an `Int` into some generic type `A`, so you write:

0 commit comments

Comments
 (0)