Skip to content

Instantly share code, notes, and snippets.

@Leonidas-from-XIV
Created July 16, 2019 12:54
Show Gist options
  • Save Leonidas-from-XIV/0e9469449458c906cf3ce1711ab3283d to your computer and use it in GitHub Desktop.
Save Leonidas-from-XIV/0e9469449458c906cf3ce1711ab3283d to your computer and use it in GitHub Desktop.
Quick and dirty, non-TR list_set_exn
open Core
let rec list_set_exn index v = function
| [] -> []
| _ :: xs when index = 0 -> v :: xs
| x :: xs -> x :: list_set_exn (Int.pred index) v xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment