Could somebody help me understand List.nth in SML?
It outputs a specified element from the list. a)
List.nth ([7,3,6,1],0);
val it = 7 : int
b)
List.nth ([7,3,6,1],1);
val it = 3 : int
For example:
- Implementation of map function using recursion would be:
fun map _ nil = nil | map f (a::b) = (f a) :: (map f b);
- Implementation of foldr function using recursion would be:
fun foldr _ c nil = c | foldr f c (a::b) = f(a, foldr f c b);
Likewise, what is actually happening inside List.nth.