Hello I am new to Sml/nj, and I am trying to modify an input to give it to a function. I'm stuck at modifying the input.
Specifically, I read the input and store it in a list. I want to make a function that given an even length list, it will make a new list, but with 2-element tuples.
For example, if my input is the list [2, 7, 4, 6, 5, 8] I want to create this list [(2, 7), (4, 6), (5, 8)]
I tried this but unfortunately it doesn't work:
fun maketuples [] = []
| maketuples x::xs = (x, hd xs) @ makektuples (tl xs)