Takes a list and an int n and returns nth element of list


Problem

Function getnth that takes a list and an int n and returns the nth element of the list, where the head of the list is the 1st element. You are only allowed to use list functions hd and tl in your solution - no other built-in functions are allowed. If the list is empty or n is invalid, return a tuple: {error, no_such_element}.

Request for Solution File

Ask an Expert for Answer!!
Data Structure & Algorithms: Takes a list and an int n and returns nth element of list
Reference No:- TGS03256818

Expected delivery within 24 Hours