I'm trying to figure out WHY i'm getting the error below more than I am interested in a correct implementation of my method.
I have the following f# code that is supposed to unpair a list of tuples into a list containing all the items in the tuples like so:
let unpair l =
let rec loop acc l =
match l with
| [] -> acc
| (x,y)::tl ->
loop (acc @ x @ y) tl
loop [] l
//should print:
// [1 2 3 4 5 6]
printf "["
List.iter (printf "%A") (unpair [(1, 2); (3, 4); (5, 6)])
printfn "]"
I get the following error for each of my ints when calling unpair: This expression was expected to have type 'a list but here has type int
Why is it expecting 'a list?