Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
let exchange (a : int, b : int) : Move =
fun circle ->
let valA = circle.[a] in
circle.[a] <- circle.[b];
circle.[b] <- valA;
circle
let partner (a : char, b : char) : Move =
fun circle ->
let idxA = Array.findIndex ((=) a) circle in
let idxB = Array.findIndex ((=) b) circle in
exchange (idxA, idxB) circle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment