Skip to content

Instantly share code, notes, and snippets.

@kunigami
Last active July 9, 2017 02:19
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/9b730bf3f0fc81d0b3c93290506164db to your computer and use it in GitHub Desktop.
Save kunigami/9b730bf3f0fc81d0b3c93290506164db to your computer and use it in GitHub Desktop.
(* Incorrect Stream.insert() version *)
let newFront = rotate {
front = rest_front;
rear = rest_rear;
schedule = newSchedule
} in
Stream.insert first_elem newFront (* ==> lazy StreamCell (first_elem, newFront) *)
(* Correct version *)
lazy (
let newFront = rotate {
front = rest_front;
rear = rest_rear;
schedule = newSchedule
} in
StreamCell (first_elem, newFront)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment