This file contains 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
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 | |
*) |
No comments:
Post a Comment