Code Examples
Snippets of SML code are most easily studied by entering them into a "top-level", also known as a read-eval-print loop. This is an interactive session that prints the inferred types of resulting or defined expressions. Many SML implementations provide an interactive top-level, including SML/NJ:
$ sml Standard ML of New Jersey v110.52 -Code can then be entered at the "-" prompt. For example, to calculate 1+2*3:
- 1 + 2 * 3; val it = 7 : intThe top-level infers the type of the expression to be "int" and gives the result "7".
Read more about this topic: Standard ML
Famous quotes containing the words code and/or examples:
“Motion or change, and identity or rest, are the first and second secrets of nature: Motion and Rest. The whole code of her laws may be written on the thumbnail, or the signet of a ring.”
—Ralph Waldo Emerson (18031882)
“In the examples that I here bring in of what I have [read], heard, done or said, I have refrained from daring to alter even the smallest and most indifferent circumstances. My conscience falsifies not an iota; for my knowledge I cannot answer.”
—Michel de Montaigne (15331592)