Skip to content

Instantly share code, notes, and snippets.

@kunigami
Created July 9, 2017 00:55
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 kunigami/a00b7a21b7572d5bb5b49d1e271c52ee to your computer and use it in GitHub Desktop.
Save kunigami/a00b7a21b7572d5bb5b49d1e271c52ee to your computer and use it in GitHub Desktop.
(*
Execute (evaluate) the first item of the schedule. If the first digit of
the item is Zero, we re-schedule the rest of the digits. If it's a One, it
means that the remaining digits have been executed, so we just discard it.
*)
let execSchedule
(schedule: digit stream list)
: digit stream list = match schedule with
| [] -> []
| firstItem :: rest -> match firstItem with
| lazy (StreamCell (Zero, job)) -> job :: rest
| _ -> rest
;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment