Created
June 21, 2012 06:57
-
-
Save klapaucius/2964305 to your computer and use it in GitHub Desktop.
records
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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