Skip to content

Commit 3faeb16

Browse files
authored
Merge pull request #25 from dskrvk/patch-1
Replace Int with T in generic insertionSort definition
2 parents 23b132f + d05d124 commit 3faeb16

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/scala/scalatutorial/sections/TypeClasses.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ object TypeClasses extends ScalaTutorialSection {
5252
*
5353
* {{{
5454
* def insertionSort[T](xs: List[T])(lessThan: (T, T) => Boolean) = {
55-
* def insert(y: Int, ys: List[Int]): List[Int] =
55+
* def insert(y: T, ys: List[T]): List[T] =
5656
* ys match {
5757
* …
5858
* case z :: zs =>
@@ -99,7 +99,7 @@ object TypeClasses extends ScalaTutorialSection {
9999
*
100100
* {{{
101101
* def insertionSort[T](xs: List[T])(ord: Ordering[T]): List[T] = {
102-
* def insert(y: Int, ys: List[Int]): List[Int] =
102+
* def insert(y: T, ys: List[T]): List[T] =
103103
* … if (ord.lt(y, z)) …
104104
*
105105
* … insert(y, insertionSort(ys)(ord)) …
@@ -127,7 +127,7 @@ object TypeClasses extends ScalaTutorialSection {
127127
*
128128
* {{{
129129
* def insertionSort[T](xs: List[T])(implicit ord: Ordering[T]): List[T] = {
130-
* def insert(y: Int, ys: List[Int]): List[Int] =
130+
* def insert(y: T, ys: List[T]): List[T] =
131131
* … if (ord.lt(y, z)) …
132132
*
133133
* … insert(y, insertionSort(ys)) …

0 commit comments

Comments
 (0)