Just picked up Ocaml and have been looking into recursive iteration and all that. I was trying to iterate through a tuple but got stumped. Let's say I want to iterate through a tuple and divide each element by half, how do I go about doing it? Especially if the size of the tuple is not known but simply given as a variable? Now if i knew it was a 2 element tuple I could do
let rec divide n = match with (a,b) -> ...
So this is where I'm stuck. How do I figure out what to match the argument with? I know tuples are fixed once created so I can't modify it in place so then how would I go about creating a new tuple that contains elements from the original tuple/2. Any help appreciated.