Skip to content

Instantly share code, notes, and snippets.

@droyo
Created May 16, 2020 22:51
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 droyo/22df91ae34634c42e8c737fb27830c61 to your computer and use it in GitHub Desktop.
Save droyo/22df91ae34634c42e8c737fb27830c61 to your computer and use it in GitHub Desktop.
# let inc p = let v = !p in incr p; v;;
val inc : int ref -> int = <fun>
# let x = ref 0;;
val x : int ref = {contents = 0}
# type t_read = {tag: int; fid: int; offset: int; count: int};;
type t_read = { tag : int; fid : int; offset : int; count : int }
# let r = {tag=(inc x); fid=(inc x); offset=(inc x); count=(inc x)};;
val r : t_read = {tag = 3; fid = 2; offset = 1; count = 0}
# let x = ref 0;;
val x : int ref = {contents = 0}
# let r = {count=(inc x); offset=(inc x); fid=(inc x); tag=(inc x)};;
val r : t_read = {tag = 3; fid = 2; offset = 1; count = 0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment