Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
fp:lab04 [2022/03/09 20:46] pdmatei |
fp:lab04 [2022/05/15 23:54] (current) vbadoiu old revision restored (2022/03/25 10:15) |
||
---|---|---|---|
Line 2: | Line 2: | ||
Objectives: | Objectives: | ||
- | * get familiar with pattern matching lists, as well as common list operations from Scala and how they work | + | * get familiar with **pattern matching** lists, as well as common list operations from Scala and how they work |
- | * get familiar with common higher-order functions over lists (partition, map, foldRight, foldLeft, filter) | + | * get familiar with common **higher-order functions** over lists (partition, map, foldRight, foldLeft, filter) |
==== 4.1. Common list operations ==== | ==== 4.1. Common list operations ==== | ||
Line 18: | Line 18: | ||
<code scala> | <code scala> | ||
def take(n: Int, l: List[Int]): List[Int] = ??? | def take(n: Int, l: List[Int]): List[Int] = ??? | ||
- | //take(3,List(1,2,3,4,5)) = 3 | + | //take(3,List(1,2,3,4,5)) = List(1,2,3) |
</code> | </code> | ||