Compilation 2016
SML basics
Aslan Askarov aslan@cs.au.dk
Revised from slides by E. Ernst
SML basics Aslan Askarov aslan@cs.au.dk Revised from slides by E. - - PowerPoint PPT Presentation
Compilation 2016 SML basics Aslan Askarov aslan@cs.au.dk Revised from slides by E. Ernst ML Functional programming language Development initiated by Robin Milner at Edinburgh in 1970s First implementation in 1974 on PDP-10
Aslan Askarov aslan@cs.au.dk
Revised from slides by E. Ernst
in 1970s
programming languages
“In 1956 […] I regarded programming as really rather
it was all rather arbitrary. It seemed to me that programming was not a very beautiful thing. So I resolved that I would never go near a computer in my life!” – R. Milner (interview by M. Bergen, 2003) ACM Turing Award, 1991
Honorary Doctorate, Aarhus University, 1998
“For three distinct and complete achievements: 1) LCF , the mechanization of Scott's Logic of Computable Functions, probably the first theoretically based yet practical tool for machine assisted proof construction; 2) ML, the first language to include polymorphic type inference together with a type-safe exception-handling mechanism; 3) CCS, a general theory of concurrency. In addition, he formulated and strongly advanced full abstraction, the study of the relationship between
automatically
and Scheme)
> sml Standard ML of New Jersey v110.76 [built: Fri Aug 1 00:28:43 2014]
hello, world! val it = () : unit
all have type int
+, -, *, div, /, mod, …
SML comes with
and disjunction is orelse
=, <>, <, <=, >, >=, …
all have type char
SML comes with
string
String.size, String.substring, String.translate
Int.fromString, Int.toString, Bool.fromString, Bool.toString, …
SMLofNJ.SysInfo.getOSName()
value has the type unit, namely ()
Conditionals in SML are expressions and hence have a types y + (if x < 0 then ~x else x) Both then and else branch are required, and must have the same type if x > 0 then ”hello” else () Error: types of if branches do not agree [tycon mismatch] then branch: string else branch: unit in expression: …