From 0dfa8bff4772db948131fcd6eaa127af6100bbee Mon Sep 17 00:00:00 2001 From: Rickard Andersson Date: Mon, 16 Aug 2021 09:07:15 +0300 Subject: [PATCH] modify freefrom exercise in pipelines Is now later in order but also more complex --- basics/01-values-and-functions.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/basics/01-values-and-functions.md b/basics/01-values-and-functions.md index 524d08e..4f00413 100644 --- a/basics/01-values-and-functions.md +++ b/basics/01-values-and-functions.md @@ -563,19 +563,20 @@ solution upperBound divisors = ### Exercises (Pipelines using partial application) -1. Define a function that takes the last 3 elements of a `[Int]`. Use notes as inspiration. - -2. Define a function using a pipeline that takes a list of `Int`, gets all the even numbers in it, +1. Define a function using a pipeline that takes a list of `Int`, gets all the even numbers in it, multiplies them all by two and returns the sum[1]. Define versions that use: - a named argument; with `&` - an unnamed argument; with `>>>` -3. Define a function using a pipeline that takes a list of `Int`, gets all the even numbers in the +2. Define a function using a pipeline that takes a list of `Int`, gets all the even numbers in the beginning of the list[2], multiplies them all by two, sums them up and returns whether or not the sum is even. Define versions that use: - a named argument; with `&` - an unnamed argument; with `>>>` +3. Define a function that takes the last 3 elements of a `[Int]` and gets the average of them. Use + notes as inspiration. + 4. Define a function using a pipeline that takes a list of strings, takes all the strings that begin with "#", then discards all leading "#" or " " from the resulting strings. Take note of what kind of structure you are working with and what we need to do to work with the structures inside.