Question: Using Haskell 1) Use head and tail to define functionfourth1 :: [a] -> a that returns the fourth item of the input list. 2) Use!!

Using Haskell

1) Use head and tail to define functionfourth1 :: [a] -> a that returns the fourth item of the input list.

2) Use!! and length to define function nthFromLast :: Int -> [a] -> a that receives a number n and a list, and returns nth item of the list from last. For example,nthFromLast 3 [1..7] must return 5.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!