Skip to content

Instantly share code, notes, and snippets.

@robbypelssers
Created October 12, 2013 12:06
records and tuples (SML)
val product1 = {name="Iphone 5", price=400, madeByApple=true};
val productname = #name product1;
(* tuples are just syntactic sugar for records *)
val product2 = {1="GalaxyS4", 2=400};
val price = #2 product2;
(* output of program
- use "records.sml";
[opening records.sml]
val product1 = {madeByApple=true,name="Iphone 5",price=400}
: {madeByApple:bool, name:string, price:int}
val productname = "Iphone 5" : string
val product2 = ("GalaxyS4",400) : string * int
val price = 400 : int
val it = () : unit
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment