I have a homework where I need to redefine the drop function in terms of the map or filter function.
drop n (:xs) = drop (n-1) (xs) drop 3 [1,2,3,4,5] = [4,5]
I have an idea but I'm not sure how to implement it. First you zip the elements of the list (say xs) with [1..] and you get elements of the list paired with these numbers (say (x,y)). Then you somehow try to filter these pairs in such a way that y would be greater than 3.
Then you print out the elements of x from the filtered pairs.
But I struggle to put this idea into code. Any help I can get or suggestions about the idea would be much appreciated.