How to make a list of pairs of type ('a * 'a) list?

Hi, I am trying to make a function to pair up elements, and drop the last remaining element at the end. For example [1;2;3;4;5;6;7] would return [(1,2); (3,4); (5,6)]

So far I have:
let pair lst =
let rec pair’ lst lst2 =
match lst with
| [] → []
| x :: xs :: xss → pair’ xss (x,xs :: lst2) in
pair’ lst []

You forgot to tell us what the problem is.

And also to format the code properly. There’s a button in the toolbar for that. Select the text, press the button, and that’s it.

Your function doesn’t match a list with odd numbers of elements. Here it is your homeworks:

let l = [1;2;3;4;5;6;7];;

let rec pl l = match l with
| [] -> []
| x::[] -> []
| x::xs::xs' -> (x,xs)::(pl xs')

pl l;;