I need some help to solve a task on function composition in Haskell. I need to write a function that given an Integer n and a list of inner lists of elements, returns the list of n-th element in each inner list. So it would be like: select 2 [[2,3,4],[5,6],[9,9,9]] = [3,6,9]. The thing is, I need to write it using function composition so it should look like select = .... In other words, I want to make this point-free.
For now, I have the following:
select::Int->[[Int]]->[Int] select a = map $ head. reverse. take a I'm stuck with it, I don't know how to remove those a from the first and only clause. Can anybody help me with this?:)
afrom the definition.select 2 [[2,3,4],[5,6],[9,9,9]] = [3,6,9], which implies that the first element of the list is at index 1. This is non-standard in Haskell (and most programming languages)—typically lists are indexed starting at 0. To me, this would be the expected behavior:select 1 [[2,3,4],[5,6],[9,9,9]] = [3,6,9].