Skip to content

Instantly share code, notes, and snippets.

@Leonidas-from-XIV
Created July 16, 2019 12:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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