Skip to content

Instantly share code, notes, and snippets.

@scoiatael
Created January 23, 2018 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scoiatael/dd743faa570f81a1884e0c99e02e77ea to your computer and use it in GitHub Desktop.
Save scoiatael/dd743faa570f81a1884e0c99e02e77ea to your computer and use it in GitHub Desktop.
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