Q:

Swapping two mutable values

This is given as the structure of the queue
 type 'a dqnode = {
 v: 'a;
 mutable next: 'a dqnode option;
 mutable prev: 'a dqnode option;
}

type 'a deque = {
mutable head: 'a dqnode option;
mutable tail: 'a dqnode option;
}

I'm trying to reverse a queue and I know that I want to switch the pointers for each node. For example, if I match 'a dqnode option from the queue to Some n, then I want to change n.next <- n.prev and n.prev (in the original state) <- n.next
Is there a way of storing 'a dqnode option at the beginning of my code so that I can switch the two pointers?
Something like: 
let newnode1:'a dqnode option = n.prev in 
n.prev <- n.next; n.next <- newnode1

Otherwise, I just end up with two pointers in the n.next position.

A:

Your description of the problem is entirely correct, and your proposed solution is also correct.

