Simple swap macro. The following code is equivalent to
#define SWAP(a, b) {auto t = a; a = b; b = t;}
except with much better typechecking and less error prone
swap :: (a: Code, b: Code) #expand {
t := (#insert a);
(#insert a) = (#insert b);
(#insert b) = t;
}
Here is what you would when using the swap macro:
array: [10] int;
swap(array[0], array[1]);
Note, in go you can simply do a,b = b,a
, but not in jai!