Skip to content

Instantly share code, notes, and snippets.

@haesbaert
Created February 11, 2017 00:39
Show Gist options
  • Save haesbaert/6a181d690f542c4fa892ef0726ae17bb to your computer and use it in GitHub Desktop.
Save haesbaert/6a181d690f542c4fa892ef0726ae17bb to your computer and use it in GitHub Desktop.
(* case 1 *)
let rec expand need kn =
if (Cstruct.len kn) >= need then
kn
else
expand need (hf [k; h; kn])
in
(* case 2 *)
let need = 10 in
let rec expand kn =
if (Cstruct.len kn) >= need then
kn
else
expand (hf [k; h; kn])
in
Q) Are both tail recursive ? case 2 captures the bound outer 'n', does it still tailcall ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment