Skip to content

Commit 5dfafa1

Browse files
authored
Fix some minor typos in chapter 3.3 (freechipsproject#155)
1 parent 0e23365 commit 5dfafa1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

3.3_higher-order_functions.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,22 @@
9090
"\n",
9191
"## Different ways of specifying functions\n",
9292
"You may have noticed that there were two ways of specifying functions in the examples above:\n",
93-
"- For functions where each argument is referred to exactly once, you *may* be able to use an underscore (`_`) to refer to each argument. In the example above, the `reduce` argument function took two arguments and could be specified as `_ + _`. While convenient, this is subject to an additional set of arcane rules, so if it does't work, try:\n",
93+
"- For functions where each argument is referred to exactly once, you *may* be able to use an underscore (`_`) to refer to each argument. In the example above, the `reduce` argument function took two arguments and could be specified as `_ + _`. While convenient, this is subject to an additional set of arcane rules, so if it doesn't work, try:\n",
9494
"- Specifying the inputs argument list explicitly. The reduce could have been explicitly written as `(a, b) => a + b`, with the general form of putting the argument list in parentheses, followed by `=>`, followed by the function body referring to those arguments.\n",
9595
"- When tuple unpacking is needed, using a `case` statement, as in `case (a, b) => a * b`. That takes a single argument, a tuple of two elements, and unpacks it into variables `a` and `b`, which can then be used in the function body.\n",
9696
"\n",
9797
"## Practice in Scala\n",
9898
"In the last module, we've seen major classes in the Scala Collections API, like `List`s.\n",
9999
"These higher-order functions are part of these APIs - and in fact, the above example uses the `map` and `reduce` API on `List`s.\n",
100100
"In this section, we'll familiarize ourselves with these methods through examples and exercises.\n",
101-
"In these examples, we'll operate on Scala numbers (`Int`s) for the sake of simpliciy and clarify, but because Chisel operators behave similarly, the concepts should generalize.\n",
101+
"In these examples, we'll operate on Scala numbers (`Int`s) for the sake of simplicity and clarity, but because Chisel operators behave similarly, the concepts should generalize.\n",
102102
"\n",
103103
"<span style=\"color:blue\">**Example: Map**</span><br>\n",
104104
"`List[A].map` has type signature `map[B](f: (A) ⇒ B): List[B]`. You'll learn more about types in a later module. For now, think of types A and B as `Int`s or `UInt`s, meaning they could be software or hardware types.\n",
105105
"\n",
106106
"In plain English, it takes an argument of type `(f: (A) ⇒ B)`, or a function that takes one argument of type `A` (the same type as the element of the input List) and returns a value of type `B` (which can be anything). `map` then returns a new list of type `B` (the return type of the argument function).\n",
107107
"\n",
108-
"As we've already explained the behavior of List in the FIR explanation, let's get straight into the examples and exercises:"
108+
"As we've already explained the behavior of List in the FIR example, let's get straight into the examples and exercises:"
109109
]
110110
},
111111
{
@@ -158,9 +158,9 @@
158158
"It takes no arguments, but returns a list where each element is a tuple of the original elements, and the index (with the first one being zero).\n",
159159
"So `List(\"a\", \"b\", \"c\", \"d\").zipWithIndex` would return `List((\"a\", 0), (\"b\", 1), (\"c\", 2), (\"d\", 3))`\n",
160160
"\n",
161-
"This is useful when then element index is needed in some operation.\n",
161+
"This is useful when the element index is needed in some operation.\n",
162162
"\n",
163-
"Since this is a pretty straightforward, we'll just have some examples:"
163+
"Since this is pretty straightforward, we'll just have some examples:"
164164
]
165165
},
166166
{
@@ -401,4 +401,4 @@
401401
},
402402
"nbformat": 4,
403403
"nbformat_minor": 1
404-
}
404+
}

0 commit comments

Comments
 (0)