Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
pp:2025:scala:l04 [2025/03/19 20:50] cata_chiru |
pp:2025:scala:l04 [2025/03/19 20:51] (current) cata_chiru |
||
---|---|---|---|
Line 17: | Line 17: | ||
</code> | </code> | ||
- | **4.1.4.** Write a function which takes a predicate ''p: Int => Boolean'', a list ''l'' and returns a sublist of ''l'' containing those elements for which ''p'' is true. The function should be **curried**. | + | **4.1.2.** Write a function which takes a predicate ''p: Int => Boolean'', a list ''l'' and returns a sublist of ''l'' containing those elements for which ''p'' is true. The function should be **curried**. |
<code scala> | <code scala> | ||
Line 24: | Line 24: | ||
</code> | </code> | ||
- | **4.1.5.** Write a function which uses a predicate to partition (split) a list. | + | **4.1.3.** Write a function which uses a predicate to partition (split) a list. |
<code scala> | <code scala> | ||
def part(p: Int => Boolean)(l: List[Int]): (List[Int], List[Int]) = ??? | def part(p: Int => Boolean)(l: List[Int]): (List[Int], List[Int]) = ??? |