You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _overviews/scala3-book/fun-write-map-function.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Focusing only on a `List[Int]`, you state:
18
18
> I want to write a `map` method that can be used to apply a function to each element in a `List[Int]` that it’s given, returning the transformed elements as a new list.
19
19
20
20
Given that statement, you start to write the method signature.
21
-
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:
21
+
First, you know that you want to accept a function as a parameter, and that function should transform an `Int` into some type `A`, so you write:
22
22
23
23
{% tabs map-accept-func-definition %}
24
24
{% tab 'Scala 2 and 3' %}
@@ -28,7 +28,7 @@ def map(f: (Int) => A)
28
28
{% endtab %}
29
29
{% endtabs %}
30
30
31
-
The syntax for using a generic type requires declaring that type symbol before the parameter list, so you add that:
31
+
The syntax for using a type parameter requires declaring it in square brackets `[]` before the parameter list, so you add that:
0 commit comments