Skip to content

Instantly share code, notes, and snippets.

@klapaucius
Created June 21, 2012 06:57
Show Gist options
  • Save klapaucius/2964305 to your computer and use it in GitHub Desktop.
Save klapaucius/2964305 to your computer and use it in GitHub Desktop.
records
structure S1 = struct
fun foo (x:{cells:int list, columns:int, rows:int}) = (#columns x, #rows x, #cells x)
end;
structure S2 = struct
fun foo (x:{cells:int list, columns:int, rows:int}) = (#columns x, #rows x, #cells x)
end;
S1.foo {columns = 1, rows = 2, cells = [1,2]};
val it = (1,2,[1,2]) : int * int * int list
val record = {columns = 2, rows = 1, cells = [1,2]};
val record = {cells=[1,2],columns=2,rows=1}
: {cells:int list, columns:int, rows:int}
S1.foo record;
val it = (2,1,[1,2]) : int * int * int list
S2.foo record;
val it = (2,1,[1,2]) : int * int * int list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment