CINXE.COM

Standard ML - Wikipedia

<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-sticky-header-enabled vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Standard ML - Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-sticky-header-enabled vector-toc-available";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"5d05a255-50c7-44ac-ad80-0ef47ecbc044","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Standard_ML","wgTitle":"Standard ML","wgCurRevisionId":1277968932,"wgRevisionId":1277968932,"wgArticleId":100337,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Articles with short description","Short description is different from Wikidata","Articles needing cleanup from November 2021","All pages needing cleanup","Articles containing how-to sections","Articles needing additional references from November 2021","All articles needing additional references","Articles with multiple maintenance issues","Articles needing additional references from June 2013","All articles with unsourced statements","Articles with unsourced statements from May 2015","Articles with unsourced statements from August 2008","Webarchive template wayback links","High-level programming languages","Functional languages","Procedural programming languages","ML programming language family","Programming languages created in 1983"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Standard_ML","wgRelevantArticleId":100337,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":false,"wgFlaggedRevsParams":{"tags":{"status":{"levels":1}}},"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":30000,"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q597330","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGELevelingUpEnabledForUser":false}; RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","ext.pygments":"ready","ext.math.styles":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","jquery.makeCollapsible.styles":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready"};RLPAGEMODULES=["ext.cite.ux-enhancements","ext.pygments.view","site","mediawiki.page.ready","jquery.makeCollapsible","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.ReferenceTooltips","ext.gadget.switcher","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns","ext.cx.uls.quick.actions","wikibase.client.vector-2022","ext.checkUser.clientHints","ext.quicksurveys.init","ext.growthExperiments.SuggestedEditSession"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=ext.cite.styles%7Cext.math.styles%7Cext.pygments%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cjquery.makeCollapsible.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&amp;only=styles&amp;skin=vector-2022"> <script async="" src="/w/load.php?lang=en&amp;modules=startup&amp;only=scripts&amp;raw=1&amp;skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=site.styles&amp;only=styles&amp;skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.22"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="Standard ML - Wikipedia"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//en.m.wikipedia.org/wiki/Standard_ML"> <link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=Standard_ML&amp;action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (en)"> <link rel="EditURI" type="application/rsd+xml" href="//en.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://en.wikipedia.org/wiki/Standard_ML"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php?title=Special:RecentChanges&amp;feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Standard_ML rootpage-Standard_ML skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" title="Main menu" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Main_Page" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-contents" class="mw-list-item"><a href="/wiki/Wikipedia:Contents" title="Guides to browsing Wikipedia"><span>Contents</span></a></li><li id="n-currentevents" class="mw-list-item"><a href="/wiki/Portal:Current_events" title="Articles related to current events"><span>Current events</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Visit a randomly selected article [x]" accesskey="x"><span>Random article</span></a></li><li id="n-aboutsite" class="mw-list-item"><a href="/wiki/Wikipedia:About" title="Learn about Wikipedia and how it works"><span>About Wikipedia</span></a></li><li id="n-contactpage" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us" title="How to contact Wikipedia"><span>Contact us</span></a></li> </ul> </div> </div> <div id="p-interaction" class="vector-menu mw-portlet mw-portlet-interaction" > <div class="vector-menu-heading"> Contribute </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Help:Contents" title="Guidance on how to use and edit Wikipedia"><span>Help</span></a></li><li id="n-introduction" class="mw-list-item"><a href="/wiki/Help:Introduction" title="Learn how to edit Wikipedia"><span>Learn to edit</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Community_portal" title="The hub for editors"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes to Wikipedia [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_upload_wizard" title="Add images or other media for use on Wikipedia"><span>Upload file</span></a></li><li id="n-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages"><span>Special pages</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Main_Page" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="Wikipedia" src="/static/images/mobile/copyright/wikipedia-wordmark-en.svg" style="width: 7.5em; height: 1.125em;"> <img class="mw-logo-tagline" alt="The Free Encyclopedia" src="/static/images/mobile/copyright/wikipedia-tagline-en.svg" width="117" height="13" style="width: 7.3125em; height: 0.8125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search Wikipedia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia" aria-label="Search Wikipedia" autocapitalize="sentences" title="Search Wikipedia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page&#039;s font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/?wmf_source=donate&amp;wmf_medium=sidebar&amp;wmf_campaign=en.wikipedia.org&amp;uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&amp;returnto=Standard+ML" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&amp;returnto=Standard+ML" title="You&#039;re encouraged to log in; however, it&#039;s not mandatory. [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="Log in and more options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/?wmf_source=donate&amp;wmf_medium=sidebar&amp;wmf_campaign=en.wikipedia.org&amp;uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&amp;returnto=Standard+ML" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&amp;returnto=Standard+ML" title="You&#039;re encouraged to log in; however, it&#039;s not mandatory. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">(Top)</div> </a> </li> <li id="toc-Language" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Language"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Language</span> </div> </a> <button aria-controls="toc-Language-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Language subsection</span> </button> <ul id="toc-Language-sublist" class="vector-toc-list"> <li id="toc-Functions" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Functions"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.1</span> <span>Functions</span> </div> </a> <ul id="toc-Functions-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Type_inference" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Type_inference"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2</span> <span>Type inference</span> </div> </a> <ul id="toc-Type_inference-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Declarative_definitions" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Declarative_definitions"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.3</span> <span>Declarative definitions</span> </div> </a> <ul id="toc-Declarative_definitions-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Imperative_definitions" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Imperative_definitions"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.4</span> <span>Imperative definitions</span> </div> </a> <ul id="toc-Imperative_definitions-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Lambda_functions" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Lambda_functions"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.5</span> <span>Lambda functions</span> </div> </a> <ul id="toc-Lambda_functions-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Local_definitions" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Local_definitions"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.6</span> <span>Local definitions</span> </div> </a> <ul id="toc-Local_definitions-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Type_synonyms" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Type_synonyms"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.7</span> <span>Type synonyms</span> </div> </a> <ul id="toc-Type_synonyms-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Algebraic_datatypes" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Algebraic_datatypes"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.8</span> <span>Algebraic datatypes</span> </div> </a> <ul id="toc-Algebraic_datatypes-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Pattern_matching" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Pattern_matching"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.9</span> <span>Pattern matching</span> </div> </a> <ul id="toc-Pattern_matching-sublist" class="vector-toc-list"> <li id="toc-Exhaustiveness_checking" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Exhaustiveness_checking"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.9.1</span> <span>Exhaustiveness checking</span> </div> </a> <ul id="toc-Exhaustiveness_checking-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Redundancy_checking" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Redundancy_checking"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.9.2</span> <span>Redundancy checking</span> </div> </a> <ul id="toc-Redundancy_checking-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Higher-order_functions" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Higher-order_functions"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.10</span> <span>Higher-order functions</span> </div> </a> <ul id="toc-Higher-order_functions-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Exceptions" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Exceptions"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.11</span> <span>Exceptions</span> </div> </a> <ul id="toc-Exceptions-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Module_system" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Module_system"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.12</span> <span>Module system</span> </div> </a> <ul id="toc-Module_system-sublist" class="vector-toc-list"> <li id="toc-Signatures" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Signatures"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.12.1</span> <span>Signatures</span> </div> </a> <ul id="toc-Signatures-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Structures" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Structures"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.12.2</span> <span>Structures</span> </div> </a> <ul id="toc-Structures-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Functors" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Functors"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.12.3</span> <span>Functors</span> </div> </a> <ul id="toc-Functors-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> </ul> </li> <li id="toc-Code_examples" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Code_examples"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Code examples</span> </div> </a> <button aria-controls="toc-Code_examples-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Code examples subsection</span> </button> <ul id="toc-Code_examples-sublist" class="vector-toc-list"> <li id="toc-Hello,_world!" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Hello,_world!"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.1</span> <span>Hello, world!</span> </div> </a> <ul id="toc-Hello,_world!-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Algorithms" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Algorithms"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.2</span> <span>Algorithms</span> </div> </a> <ul id="toc-Algorithms-sublist" class="vector-toc-list"> <li id="toc-Insertion_sort" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Insertion_sort"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.2.1</span> <span>Insertion sort</span> </div> </a> <ul id="toc-Insertion_sort-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Mergesort" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Mergesort"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.2.2</span> <span>Mergesort</span> </div> </a> <ul id="toc-Mergesort-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Quicksort" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Quicksort"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.2.3</span> <span>Quicksort</span> </div> </a> <ul id="toc-Quicksort-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Expression_interpreter" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Expression_interpreter"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.3</span> <span>Expression interpreter</span> </div> </a> <ul id="toc-Expression_interpreter-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Arbitrary-precision_integers" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Arbitrary-precision_integers"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.4</span> <span>Arbitrary-precision integers</span> </div> </a> <ul id="toc-Arbitrary-precision_integers-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Partial_application" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Partial_application"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.5</span> <span>Partial application</span> </div> </a> <ul id="toc-Partial_application-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Libraries" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Libraries"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Libraries</span> </div> </a> <button aria-controls="toc-Libraries-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Libraries subsection</span> </button> <ul id="toc-Libraries-sublist" class="vector-toc-list"> <li id="toc-Standard" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Standard"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.1</span> <span>Standard</span> </div> </a> <ul id="toc-Standard-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Third_party" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Third_party"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.2</span> <span>Third party</span> </div> </a> <ul id="toc-Third_party-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Implementations" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Implementations"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Implementations</span> </div> </a> <ul id="toc-Implementations-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Major_projects_using_SML" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Major_projects_using_SML"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>Major projects using SML</span> </div> </a> <ul id="toc-Major_projects_using_SML-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-References" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#References"> <div class="vector-toc-text"> <span class="vector-toc-numb">7</span> <span>References</span> </div> </a> <ul id="toc-References-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-External_links" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#External_links"> <div class="vector-toc-text"> <span class="vector-toc-numb">8</span> <span>External links</span> </div> </a> <ul id="toc-External_links-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" title="Table of Contents" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Standard ML</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="Go to an article in another language. Available in 23 languages" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-23" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">23 languages</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-ar mw-list-item"><a href="https://ar.wikipedia.org/wiki/%D8%A3%D9%85_%D8%A3%D9%84_%D8%A7%D9%84%D9%85%D8%B9%D9%8A%D8%A7%D8%B1%D9%8A%D8%A9" title="أم أل المعيارية – Arabic" lang="ar" hreflang="ar" data-title="أم أل المعيارية" data-language-autonym="العربية" data-language-local-name="Arabic" class="interlanguage-link-target"><span>العربية</span></a></li><li class="interlanguage-link interwiki-ca mw-list-item"><a href="https://ca.wikipedia.org/wiki/ML_Est%C3%A0ndard" title="ML Estàndard – Catalan" lang="ca" hreflang="ca" data-title="ML Estàndard" data-language-autonym="Català" data-language-local-name="Catalan" class="interlanguage-link-target"><span>Català</span></a></li><li class="interlanguage-link interwiki-cs mw-list-item"><a href="https://cs.wikipedia.org/wiki/Standard_ML" title="Standard ML – Czech" lang="cs" hreflang="cs" data-title="Standard ML" data-language-autonym="Čeština" data-language-local-name="Czech" class="interlanguage-link-target"><span>Čeština</span></a></li><li class="interlanguage-link interwiki-da mw-list-item"><a href="https://da.wikipedia.org/wiki/Standard_ML" title="Standard ML – Danish" lang="da" hreflang="da" data-title="Standard ML" data-language-autonym="Dansk" data-language-local-name="Danish" class="interlanguage-link-target"><span>Dansk</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Standard_ML" title="Standard ML – German" lang="de" hreflang="de" data-title="Standard ML" data-language-autonym="Deutsch" data-language-local-name="German" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-es mw-list-item"><a href="https://es.wikipedia.org/wiki/Standard_ML" title="Standard ML – Spanish" lang="es" hreflang="es" data-title="Standard ML" data-language-autonym="Español" data-language-local-name="Spanish" class="interlanguage-link-target"><span>Español</span></a></li><li class="interlanguage-link interwiki-eo mw-list-item"><a href="https://eo.wikipedia.org/wiki/Standard_ML" title="Standard ML – Esperanto" lang="eo" hreflang="eo" data-title="Standard ML" data-language-autonym="Esperanto" data-language-local-name="Esperanto" class="interlanguage-link-target"><span>Esperanto</span></a></li><li class="interlanguage-link interwiki-fa mw-list-item"><a href="https://fa.wikipedia.org/wiki/%D8%A7%D8%B3%D8%AA%D8%A7%D9%86%D8%AF%D8%A7%D8%B1%D8%AF_%D8%A7%D9%85%E2%80%8C%D8%A7%D9%84" title="استاندارد ام‌ال – Persian" lang="fa" hreflang="fa" data-title="استاندارد ام‌ال" data-language-autonym="فارسی" data-language-local-name="Persian" class="interlanguage-link-target"><span>فارسی</span></a></li><li class="interlanguage-link interwiki-fr mw-list-item"><a href="https://fr.wikipedia.org/wiki/Standard_ML" title="Standard ML – French" lang="fr" hreflang="fr" data-title="Standard ML" data-language-autonym="Français" data-language-local-name="French" class="interlanguage-link-target"><span>Français</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%ED%91%9C%EC%A4%80_ML" title="표준 ML – Korean" lang="ko" hreflang="ko" data-title="표준 ML" data-language-autonym="한국어" data-language-local-name="Korean" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-hy mw-list-item"><a href="https://hy.wikipedia.org/wiki/Standard_ML" title="Standard ML – Armenian" lang="hy" hreflang="hy" data-title="Standard ML" data-language-autonym="Հայերեն" data-language-local-name="Armenian" class="interlanguage-link-target"><span>Հայերեն</span></a></li><li class="interlanguage-link interwiki-it mw-list-item"><a href="https://it.wikipedia.org/wiki/Standard_ML" title="Standard ML – Italian" lang="it" hreflang="it" data-title="Standard ML" data-language-autonym="Italiano" data-language-local-name="Italian" class="interlanguage-link-target"><span>Italiano</span></a></li><li class="interlanguage-link interwiki-ka mw-list-item"><a href="https://ka.wikipedia.org/wiki/Standard_ML" title="Standard ML – Georgian" lang="ka" hreflang="ka" data-title="Standard ML" data-language-autonym="ქართული" data-language-local-name="Georgian" class="interlanguage-link-target"><span>ქართული</span></a></li><li class="interlanguage-link interwiki-hu mw-list-item"><a href="https://hu.wikipedia.org/wiki/SML" title="SML – Hungarian" lang="hu" hreflang="hu" data-title="SML" data-language-autonym="Magyar" data-language-local-name="Hungarian" class="interlanguage-link-target"><span>Magyar</span></a></li><li class="interlanguage-link interwiki-ml mw-list-item"><a href="https://ml.wikipedia.org/wiki/%E0%B4%B8%E0%B5%8D%E0%B4%B1%E0%B5%8D%E0%B4%B1%E0%B4%BE%E0%B5%BB%E0%B4%A1%E0%B5%87%E0%B5%BC%E0%B4%A1%E0%B5%8D_%E0%B4%8E%E0%B4%82%E0%B4%8E%E0%B5%BD" title="സ്റ്റാൻഡേർഡ് എംഎൽ – Malayalam" lang="ml" hreflang="ml" data-title="സ്റ്റാൻഡേർഡ് എംഎൽ" data-language-autonym="മലയാളം" data-language-local-name="Malayalam" class="interlanguage-link-target"><span>മലയാളം</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/Standard_ML" title="Standard ML – Japanese" lang="ja" hreflang="ja" data-title="Standard ML" data-language-autonym="日本語" data-language-local-name="Japanese" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-pl mw-list-item"><a href="https://pl.wikipedia.org/wiki/Standard_ML" title="Standard ML – Polish" lang="pl" hreflang="pl" data-title="Standard ML" data-language-autonym="Polski" data-language-local-name="Polish" class="interlanguage-link-target"><span>Polski</span></a></li><li class="interlanguage-link interwiki-pt mw-list-item"><a href="https://pt.wikipedia.org/wiki/Standard_ML" title="Standard ML – Portuguese" lang="pt" hreflang="pt" data-title="Standard ML" data-language-autonym="Português" data-language-local-name="Portuguese" class="interlanguage-link-target"><span>Português</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/Standard_ML" title="Standard ML – Russian" lang="ru" hreflang="ru" data-title="Standard ML" data-language-autonym="Русский" data-language-local-name="Russian" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-simple mw-list-item"><a href="https://simple.wikipedia.org/wiki/Standard_ML" title="Standard ML – Simple English" lang="en-simple" hreflang="en-simple" data-title="Standard ML" data-language-autonym="Simple English" data-language-local-name="Simple English" class="interlanguage-link-target"><span>Simple English</span></a></li><li class="interlanguage-link interwiki-tr mw-list-item"><a href="https://tr.wikipedia.org/wiki/Standart_ML" title="Standart ML – Turkish" lang="tr" hreflang="tr" data-title="Standart ML" data-language-autonym="Türkçe" data-language-local-name="Turkish" class="interlanguage-link-target"><span>Türkçe</span></a></li><li class="interlanguage-link interwiki-uk mw-list-item"><a href="https://uk.wikipedia.org/wiki/Standard_ML" title="Standard ML – Ukrainian" lang="uk" hreflang="uk" data-title="Standard ML" data-language-autonym="Українська" data-language-local-name="Ukrainian" class="interlanguage-link-target"><span>Українська</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/Standard_ML" title="Standard ML – Chinese" lang="zh" hreflang="zh" data-title="Standard ML" data-language-autonym="中文" data-language-local-name="Chinese" class="interlanguage-link-target"><span>中文</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q597330#sitelinks-wikipedia" title="Edit interlanguage links" class="wbc-editpage">Edit links</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Standard_ML" title="View the content page [c]" accesskey="c"><span>Article</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Standard_ML" rel="discussion" title="Discuss improvements to the content page [t]" accesskey="t"><span>Talk</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Standard_ML"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Standard_ML&amp;action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Standard_ML&amp;action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Standard_ML"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Standard_ML&amp;action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Standard_ML&amp;action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Standard_ML" title="List of all English Wikipedia pages containing links to this page [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Standard_ML" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Standard_ML&amp;oldid=1277968932" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Standard_ML&amp;action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&amp;page=Standard_ML&amp;id=1277968932&amp;wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&amp;url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FStandard_ML"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&amp;url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FStandard_ML"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&amp;page=Standard_ML&amp;action=show-download-screen" title="Download this page as a PDF file"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Standard_ML&amp;printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q597330" title="Structured data on this page hosted by Wikidata [g]" accesskey="g"><span>Wikidata item</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> </div> <div id="siteSub" class="noprint">From Wikipedia, the free encyclopedia</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">General-purpose functional programming language</div> <style data-mw-deduplicate="TemplateStyles:r1257001546">.mw-parser-output .infobox-subbox{padding:0;border:none;margin:-3px;width:auto;min-width:100%;font-size:100%;clear:none;float:none;background-color:transparent}.mw-parser-output .infobox-3cols-child{margin:auto}.mw-parser-output .infobox .navbar{font-size:100%}@media screen{html.skin-theme-clientpref-night .mw-parser-output .infobox-full-data:not(.notheme)>div:not(.notheme)[style]{background:#1f1f23!important;color:#f8f9fa}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .infobox-full-data:not(.notheme) div:not(.notheme){background:#1f1f23!important;color:#f8f9fa}}@media(min-width:640px){body.skin--responsive .mw-parser-output .infobox-table{display:table!important}body.skin--responsive .mw-parser-output .infobox-table>caption{display:table-caption!important}body.skin--responsive .mw-parser-output .infobox-table>tbody{display:table-row-group}body.skin--responsive .mw-parser-output .infobox-table tr{display:table-row!important}body.skin--responsive .mw-parser-output .infobox-table th,body.skin--responsive .mw-parser-output .infobox-table td{padding-left:inherit;padding-right:inherit}}</style><table class="infobox vevent"><caption class="infobox-title summary">Standard ML</caption><tbody><tr><th scope="row" class="infobox-label"><a href="/wiki/Programming_paradigm" title="Programming paradigm">Paradigm</a></th><td class="infobox-data"><a href="/wiki/Programming_paradigm" title="Programming paradigm">Multi-paradigm</a>: <a href="/wiki/Functional_programming" title="Functional programming">functional</a>, <a href="/wiki/Imperative_programming" title="Imperative programming">imperative</a>, <a href="/wiki/Modular_programming" title="Modular programming">modular</a><sup id="cite_ref-intro_1-0" class="reference"><a href="#cite_note-intro-1"><span class="cite-bracket">&#91;</span>1<span class="cite-bracket">&#93;</span></a></sup></td></tr><tr><th scope="row" class="infobox-label">Family</th><td class="infobox-data"><a href="/wiki/ML_(programming_language)" title="ML (programming language)">ML</a></td></tr><tr><th scope="row" class="infobox-label">First&#160;appeared</th><td class="infobox-data">1983<span class="noprint">&#59;&#32;42&#160;years ago</span><span style="display:none">&#160;(<span class="bday dtstart published updated">1983</span>)</span><sup id="cite_ref-smlnj_2-0" class="reference"><a href="#cite_note-smlnj-2"><span class="cite-bracket">&#91;</span>2<span class="cite-bracket">&#93;</span></a></sup></td></tr><tr><td colspan="2" class="infobox-full-data"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1257001546" /></td></tr><tr><th scope="row" class="infobox-label" style="white-space: nowrap;"><a href="/wiki/Software_release_life_cycle" title="Software release life cycle">Stable release</a></th><td class="infobox-data"><div style="margin:0px;">Standard ML '97<sup id="cite_ref-smlnj_2-1" class="reference"><a href="#cite_note-smlnj-2"><span class="cite-bracket">&#91;</span>2<span class="cite-bracket">&#93;</span></a></sup> / 1997<span class="noprint">&#59;&#32;28&#160;years ago</span><span style="display:none">&#160;(<span class="bday dtstart published updated">1997</span>)</span></div></td></tr><tr style="display:none"><td colspan="2"> </td></tr><tr><th scope="row" class="infobox-label"><a href="/wiki/Type_system" title="Type system">Typing discipline</a></th><td class="infobox-data"><a href="/wiki/Type_inference" title="Type inference">Inferred</a>, <a href="/wiki/Type_system#static_type_checking" title="Type system">static</a>, <a href="/wiki/Strong_and_weak_typing" title="Strong and weak typing">strong</a></td></tr><tr><th scope="row" class="infobox-label"><a href="/wiki/Filename_extension" title="Filename extension">Filename extensions</a></th><td class="infobox-data">.sml</td></tr><tr><th scope="row" class="infobox-label">Website</th><td class="infobox-data"><span class="url"><a rel="nofollow" class="external text" href="https://smlfamily.github.io/">smlfamily<wbr />.github<wbr />.io</a></span></td></tr><tr><th colspan="2" class="infobox-header" style="background-color: #eee;">Major <a href="/wiki/Programming_language_implementation" title="Programming language implementation">implementations</a></th></tr><tr><td colspan="2" class="infobox-full-data"><a href="/wiki/Standard_ML_of_New_Jersey" title="Standard ML of New Jersey">SML/NJ</a>, <a href="/wiki/MLton" title="MLton">MLton</a>, <a href="/wiki/Poly/ML" class="mw-redirect" title="Poly/ML">Poly/ML</a></td></tr><tr><th colspan="2" class="infobox-header" style="background-color: #eee;"><a href="/wiki/Programming_language#Dialects,_flavors_and_implementations" title="Programming language">Dialects</a></th></tr><tr><td colspan="2" class="infobox-full-data"><a href="/wiki/Alice_(programming_language)" title="Alice (programming language)">Alice</a>, <a href="/wiki/Concurrent_ML" title="Concurrent ML">Concurrent ML</a>, <a href="/wiki/Dependent_ML" title="Dependent ML">Dependent ML</a></td></tr><tr><th colspan="2" class="infobox-header" style="background-color: #eee;">Influenced by</th></tr><tr><td colspan="2" class="infobox-full-data"><a href="/wiki/ML_(programming_language)" title="ML (programming language)">ML</a>, <a href="/wiki/Hope_(programming_language)" title="Hope (programming language)">Hope</a>, <a href="/wiki/Pascal_(programming_language)" title="Pascal (programming language)">Pascal</a></td></tr><tr><th colspan="2" class="infobox-header" style="background-color: #eee;">Influenced</th></tr><tr><td colspan="2" class="infobox-full-data"><a href="/wiki/Elm_(programming_language)" title="Elm (programming language)">Elm</a>, <a href="/wiki/F_Sharp_(programming_language)" title="F Sharp (programming language)">F#</a>, <a href="/wiki/F*_(programming_language)" title="F* (programming language)">F*</a>, <a href="/wiki/Haskell" title="Haskell">Haskell</a>, <a href="/wiki/OCaml" title="OCaml">OCaml</a>, <a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a>,<sup id="cite_ref-itertools_3-0" class="reference"><a href="#cite_note-itertools-3"><span class="cite-bracket">&#91;</span>3<span class="cite-bracket">&#93;</span></a></sup> <a href="/wiki/Rust_(programming_language)" title="Rust (programming language)">Rust</a>,<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">&#91;</span>4<span class="cite-bracket">&#93;</span></a></sup> <a href="/wiki/Scala_(programming_language)" title="Scala (programming language)">Scala</a></td></tr></tbody></table> <p><b>Standard ML</b> (<b>SML</b>) is a <a href="/wiki/General-purpose_programming_language" title="General-purpose programming language">general-purpose</a>, <a href="/wiki/High-level_programming_language" title="High-level programming language">high-level</a>, <a href="/wiki/Modular_programming" title="Modular programming">modular</a>, <a href="/wiki/Functional_programming" title="Functional programming">functional</a> <a href="/wiki/Programming_language" title="Programming language">programming language</a> with compile-time <a href="/wiki/Type_checking" class="mw-redirect" title="Type checking">type checking</a> and <a href="/wiki/Type_inference" title="Type inference">type inference</a>. It is popular for writing <a href="/wiki/Compiler" title="Compiler">compilers</a>, for <a href="/wiki/Programming_language_research" class="mw-redirect" title="Programming language research">programming language research</a>, and for developing <a href="/wiki/Automated_theorem_proving" title="Automated theorem proving">theorem provers</a>. </p><p>Standard ML is a modern dialect of <a href="/wiki/ML_(programming_language)" title="ML (programming language)">ML</a>, the language used in the <a href="/wiki/Logic_for_Computable_Functions" title="Logic for Computable Functions">Logic for Computable Functions</a> (LCF) theorem-proving project. It is distinctive among widely used languages in that it has a <a href="/wiki/Formal_specification" title="Formal specification">formal specification</a>, given as <a href="/wiki/Typing_rule" title="Typing rule">typing rules</a> and <a href="/wiki/Operational_semantics" title="Operational semantics">operational semantics</a> in <i>The Definition of Standard ML</i>.<sup id="cite_ref-revision_5-0" class="reference"><a href="#cite_note-revision-5"><span class="cite-bracket">&#91;</span>5<span class="cite-bracket">&#93;</span></a></sup> </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Language">Language</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=1" title="Edit section: Language"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1251242444">.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}</style><style data-mw-deduplicate="TemplateStyles:r1248332772">.mw-parser-output .multiple-issues-text{width:95%;margin:0.2em 0}.mw-parser-output .multiple-issues-text>.mw-collapsible-content{margin-top:0.3em}.mw-parser-output .compact-ambox .ambox{border:none;border-collapse:collapse;background-color:transparent;margin:0 0 0 1.6em!important;padding:0!important;width:auto;display:block}body.mediawiki .mw-parser-output .compact-ambox .ambox.mbox-small-left{font-size:100%;width:auto;margin:0}.mw-parser-output .compact-ambox .ambox .mbox-text{padding:0!important;margin:0!important}.mw-parser-output .compact-ambox .ambox .mbox-text-span{display:list-item;line-height:1.5em;list-style-type:disc}body.skin-minerva .mw-parser-output .multiple-issues-text>.mw-collapsible-toggle,.mw-parser-output .compact-ambox .ambox .mbox-image,.mw-parser-output .compact-ambox .ambox .mbox-imageright,.mw-parser-output .compact-ambox .ambox .mbox-empty-cell,.mw-parser-output .compact-ambox .hide-when-compact{display:none}</style><table class="box-Multiple_issues plainlinks metadata ambox ambox-content ambox-multiple_issues compact-ambox" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/b/b4/Ambox_important.svg/40px-Ambox_important.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/b/b4/Ambox_important.svg/60px-Ambox_important.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/b/b4/Ambox_important.svg/80px-Ambox_important.svg.png 2x" data-file-width="40" data-file-height="40" /></span></span></div></td><td class="mbox-text"><div class="mbox-text-span"><div class="multiple-issues-text mw-collapsible"><b>This section has multiple issues.</b> Please help <b><a href="/wiki/Special:EditPage/Standard_ML" title="Special:EditPage/Standard ML">improve it</a></b> or discuss these issues on the <b><a href="/wiki/Talk:Standard_ML" title="Talk:Standard ML">talk page</a></b>. <small><i>(<a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove these messages</a>)</i></small> <div class="mw-collapsible-content"> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1251242444" /><table class="box-Howto plainlinks metadata ambox ambox-content" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/b/b4/Ambox_important.svg/40px-Ambox_important.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/b/b4/Ambox_important.svg/60px-Ambox_important.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/b/b4/Ambox_important.svg/80px-Ambox_important.svg.png 2x" data-file-width="40" data-file-height="40" /></span></span></div></td><td class="mbox-text"><div class="mbox-text-span">This section <b>contains <a href="/wiki/Wikipedia:What_Wikipedia_is_not#NOTHOWTO" title="Wikipedia:What Wikipedia is not">instructions, advice, or how-to content</a></b>.<span class="hide-when-compact"> Please help <a class="external text" href="https://en.wikipedia.org/w/index.php?title=Standard_ML&amp;action=edit">rewrite the content</a> so that it is more encyclopedic or <a href="https://meta.wikimedia.org/wiki/Help:Transwiki" class="extiw" title="m:Help:Transwiki">move</a> it to <a href="https://en.wikiversity.org/wiki/" class="extiw" title="v:">Wikiversity</a>, <a href="https://en.wikibooks.org/wiki/" class="extiw" title="b:">Wikibooks</a>, or <a href="https://en.wikivoyage.org/wiki/" class="extiw" title="voy:">Wikivoyage</a>.</span> <span class="date-container"><i>(<span class="date">November 2021</span>)</i></span></div></td></tr></tbody></table> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1251242444" /><table class="box-Unreferenced_section plainlinks metadata ambox ambox-content ambox-Unreferenced" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><a href="/wiki/File:Question_book-new.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/50px-Question_book-new.svg.png" decoding="async" width="50" height="39" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/75px-Question_book-new.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/100px-Question_book-new.svg.png 2x" data-file-width="512" data-file-height="399" /></a></span></div></td><td class="mbox-text"><div class="mbox-text-span">This section <b>does not <a href="/wiki/Wikipedia:Citing_sources" title="Wikipedia:Citing sources">cite</a> any <a href="/wiki/Wikipedia:Verifiability" title="Wikipedia:Verifiability">sources</a></b>.<span class="hide-when-compact"> Please help <a href="/wiki/Special:EditPage/Standard_ML" title="Special:EditPage/Standard ML">improve this section</a> by <a href="/wiki/Help:Referencing_for_beginners" title="Help:Referencing for beginners">adding citations to reliable sources</a>. Unsourced material may be challenged and <a href="/wiki/Wikipedia:Verifiability#Burden_of_evidence" title="Wikipedia:Verifiability">removed</a>.</span> <span class="date-container"><i>(<span class="date">November 2021</span>)</i></span><span class="hide-when-compact"><i> (<small><a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove this message</a></small>)</i></span></div></td></tr></tbody></table> </div> </div><span class="hide-when-compact"><i> (<small><a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove this message</a></small>)</i></span></div></td></tr></tbody></table> <p>Standard ML is a functional <a href="/wiki/Programming_language" title="Programming language">programming language</a> with some impure features. Programs written in Standard ML consist of <a href="/wiki/Expression_(computer_science)" title="Expression (computer science)">expressions</a> in contrast to statements or commands, although some expressions of type <a href="/wiki/Unit_type" title="Unit type">unit</a> are only evaluated for their <a href="/wiki/Side_effect_(computer_science)" title="Side effect (computer science)">side-effects</a>. </p> <div class="mw-heading mw-heading3"><h3 id="Functions">Functions</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=2" title="Edit section: Functions"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Like all functional languages, a key feature of Standard ML is the <a href="/wiki/Function_(programming)" class="mw-redirect" title="Function (programming)">function</a>, which is used for abstraction. The factorial function can be expressed as follows: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">factorial</span> <span class="n">n</span> <span class="p">=</span> <span class="kr">if</span> <span class="n">n</span> <span class="p">=</span> <span class="mi">0</span> <span class="kr">then</span> <span class="mi">1</span> <span class="kr">else</span> <span class="n">n</span> <span class="n">*</span> <span class="n">factorial</span> <span class="p">(</span><span class="n">n</span> <span class="n">-</span> <span class="mi">1</span><span class="p">)</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Type_inference">Type inference</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=3" title="Edit section: Type inference"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>An SML compiler must infer the static type <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">val</span> <span class="nv">factorial</span> <span class="p">:</span> <span class="n">int</span> <span class="p">-&gt;</span> <span class="n">int</span></code> without user-supplied type annotations. It has to deduce that <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">n</code> is only used with integer expressions, and must therefore itself be an integer, and that all terminal expressions are integer expressions. </p> <div class="mw-heading mw-heading3"><h3 id="Declarative_definitions">Declarative definitions</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=4" title="Edit section: Declarative definitions"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The same function can be expressed with <a href="/w/index.php?title=Clausal_function_definition&amp;action=edit&amp;redlink=1" class="new" title="Clausal function definition (page does not exist)">clausal function definitions</a> where the <i>if</i>-<i>then</i>-<i>else</i> conditional is replaced with templates of the factorial function evaluated for specific values: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">factorial</span> <span class="mi">0</span> <span class="p">=</span> <span class="mi">1</span> <span class="p">|</span> <span class="nf">factorial</span> <span class="n">n</span> <span class="p">=</span> <span class="n">n</span> <span class="n">*</span> <span class="n">factorial</span> <span class="p">(</span><span class="n">n</span> <span class="n">-</span> <span class="mi">1</span><span class="p">)</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Imperative_definitions">Imperative definitions</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=5" title="Edit section: Imperative definitions"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>or iteratively: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">factorial</span> <span class="n">n</span> <span class="p">=</span> <span class="kr">let</span> <span class="kr">val</span> <span class="nv">i</span> <span class="p">=</span> <span class="n">ref</span> <span class="n">n</span> <span class="kr">and</span> <span class="nv">acc</span> <span class="p">=</span> <span class="n">ref</span> <span class="mi">1</span> <span class="kr">in</span> <span class="kr">while</span> <span class="n">!i</span> <span class="n">&gt;</span> <span class="mi">0</span> <span class="kr">do</span> <span class="p">(</span><span class="n">acc</span> <span class="n">:=</span> <span class="n">!acc</span> <span class="n">*</span> <span class="n">!i</span><span class="p">;</span> <span class="n">i</span> <span class="n">:=</span> <span class="n">!i</span> <span class="n">-</span> <span class="mi">1</span><span class="p">);</span> <span class="n">!acc</span> <span class="kr">end</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Lambda_functions">Lambda functions</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=6" title="Edit section: Lambda functions"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>or as a lambda function: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">val</span> <span class="nv">rec</span> <span class="n">factorial</span> <span class="p">=</span> <span class="kr">fn</span> <span class="mi">0</span> <span class="p">=&gt;</span> <span class="mi">1</span> <span class="n">|</span> <span class="n">n</span> <span class="p">=&gt;</span> <span class="n">n</span> <span class="n">*</span> <span class="n">factorial</span> <span class="p">(</span><span class="n">n</span> <span class="n">-</span> <span class="mi">1</span><span class="p">)</span> </pre></div> <p>Here, the keyword <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">val</span></code> introduces a binding of an identifier to a value, <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">fn</span></code> introduces an <a href="/wiki/Anonymous_function" title="Anonymous function">anonymous function</a>, and <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">rec</span></code> allows the definition to be self-referential. </p> <div class="mw-heading mw-heading3"><h3 id="Local_definitions">Local definitions</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=7" title="Edit section: Local definitions"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The encapsulation of an invariant-preserving tail-recursive tight loop with one or more accumulator parameters within an invariant-free outer function, as seen here, is a common idiom in Standard ML. </p><p>Using a local function, it can be rewritten in a more efficient tail-recursive style: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">local</span> <span class="kr">fun</span> <span class="nf">loop</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">acc</span><span class="p">)</span> <span class="p">=</span> <span class="n">acc</span> <span class="p">|</span> <span class="nf">loop</span> <span class="p">(</span><span class="n">m</span><span class="p">,</span> <span class="n">acc</span><span class="p">)</span> <span class="p">=</span> <span class="n">loop</span> <span class="p">(</span><span class="n">m</span> <span class="n">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">m</span> <span class="n">*</span> <span class="n">acc</span><span class="p">)</span> <span class="kr">in</span> <span class="kr">fun</span> <span class="nf">factorial</span> <span class="n">n</span> <span class="p">=</span> <span class="n">loop</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="kr">end</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Type_synonyms">Type synonyms</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=8" title="Edit section: Type synonyms"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A type synonym is defined with the keyword <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">type</span></code>. Here is a type synonym for points on a <a href="/wiki/Plane_(geometry)" class="mw-redirect" title="Plane (geometry)">plane</a>, and functions computing the distances between two points, and the area of a triangle with the given corners as per <a href="/wiki/Heron%27s_formula" title="Heron&#39;s formula">Heron's formula</a>. (These definitions will be used in subsequent examples). </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">type</span> <span class="kt">loc</span> <span class="p">=</span> <span class="n">real</span> <span class="n">*</span> <span class="n">real</span> <span class="kr">fun</span> <span class="nf">square</span> <span class="p">(</span><span class="n">x</span> <span class="p">:</span> <span class="n">real</span><span class="p">)</span> <span class="p">=</span> <span class="n">x</span> <span class="n">*</span> <span class="n">x</span> <span class="kr">fun</span> <span class="nf">dist</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="p">(</span><span class="n">x&#39;</span><span class="p">,</span> <span class="n">y&#39;</span><span class="p">)</span> <span class="p">=</span> <span class="nn">Math</span><span class="p">.</span><span class="n">sqrt</span> <span class="p">(</span><span class="n">square</span> <span class="p">(</span><span class="n">x&#39;</span> <span class="n">-</span> <span class="n">x</span><span class="p">)</span> <span class="n">+</span> <span class="n">square</span> <span class="p">(</span><span class="n">y&#39;</span> <span class="n">-</span> <span class="n">y</span><span class="p">))</span> <span class="kr">fun</span> <span class="nf">heron</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span><span class="p">)</span> <span class="p">=</span> <span class="kr">let</span> <span class="kr">val</span> <span class="nv">x</span> <span class="p">=</span> <span class="n">dist</span> <span class="n">a</span> <span class="n">b</span> <span class="kr">val</span> <span class="nv">y</span> <span class="p">=</span> <span class="n">dist</span> <span class="n">b</span> <span class="n">c</span> <span class="kr">val</span> <span class="nv">z</span> <span class="p">=</span> <span class="n">dist</span> <span class="n">a</span> <span class="n">c</span> <span class="kr">val</span> <span class="nv">s</span> <span class="p">=</span> <span class="p">(</span><span class="n">x</span> <span class="n">+</span> <span class="n">y</span> <span class="n">+</span> <span class="n">z</span><span class="p">)</span> <span class="n">/</span> <span class="mf">2.0</span> <span class="kr">in</span> <span class="nn">Math</span><span class="p">.</span><span class="n">sqrt</span> <span class="p">(</span><span class="n">s</span> <span class="n">*</span> <span class="p">(</span><span class="n">s</span> <span class="n">-</span> <span class="n">x</span><span class="p">)</span> <span class="n">*</span> <span class="p">(</span><span class="n">s</span> <span class="n">-</span> <span class="n">y</span><span class="p">)</span> <span class="n">*</span> <span class="p">(</span><span class="n">s</span> <span class="n">-</span> <span class="n">z</span><span class="p">))</span> <span class="kr">end</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Algebraic_datatypes">Algebraic datatypes</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=9" title="Edit section: Algebraic datatypes"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Standard ML provides strong support for <a href="/wiki/Algebraic_datatype" class="mw-redirect" title="Algebraic datatype">algebraic datatypes</a> (ADT). A <a href="/wiki/Data_type" title="Data type">data type</a> can be thought of as a <a href="/wiki/Disjoint_union" title="Disjoint union">disjoint union</a> of tuples (or a "sum of products"). They are easy to define and easy to use, largely because of <a href="/wiki/Pattern_matching" title="Pattern matching">pattern matching</a>, and most Standard ML implementations' <a href="/wiki/Partial_function" title="Partial function">pattern-exhaustiveness</a> checking and pattern redundancy checking. </p><p>In <a href="/wiki/Object-oriented_programming" title="Object-oriented programming">object-oriented programming</a> languages, a disjoint union can be expressed as <a href="/wiki/Class_(computer_programming)" title="Class (computer programming)">class</a> hierarchies. However, in contrast to <a href="/wiki/Class_hierarchy" title="Class hierarchy">class hierarchies</a>, ADTs are <a href="/wiki/Closed-world_assumption" title="Closed-world assumption">closed</a>. Thus, the extensibility of ADTs is orthogonal to the extensibility of class hierarchies. Class hierarchies can be extended with new subclasses which implement the same interface, while the functions of ADTs can be extended for the fixed set of constructors. See <a href="/wiki/Expression_problem" title="Expression problem">expression problem</a>. </p><p>A datatype is defined with the keyword <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">datatype</span></code>, as in: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">datatype</span> <span class="kt">shape</span> <span class="p">=</span> <span class="nc">Circle</span> <span class="kr">of</span> <span class="n">loc</span> <span class="n">*</span> <span class="n">real</span> <span class="cm">(* center and radius *)</span> <span class="p">|</span> <span class="nc">Square</span> <span class="kr">of</span> <span class="n">loc</span> <span class="n">*</span> <span class="n">real</span> <span class="cm">(* upper-left corner and side length; axis-aligned *)</span> <span class="p">|</span> <span class="nc">Triangle</span> <span class="kr">of</span> <span class="n">loc</span> <span class="n">*</span> <span class="n">loc</span> <span class="n">*</span> <span class="n">loc</span> <span class="cm">(* corners *)</span> </pre></div> <p>Note that a type synonym cannot be recursive; datatypes are necessary to define recursive constructors. (This is not at issue in this example.) </p> <div class="mw-heading mw-heading3"><h3 id="Pattern_matching">Pattern matching</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=10" title="Edit section: Pattern matching"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Patterns are matched in the order in which they are defined. <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a> programmers can use <a href="/wiki/Tagged_union" title="Tagged union">tagged unions</a>, dispatching on tag values, to do what ML does with datatypes and pattern matching. Nevertheless, while a C program decorated with appropriate checks will, in a sense, be as robust as the corresponding ML program, those checks will of necessity be dynamic; ML's <a href="/wiki/Static_program_analysis" title="Static program analysis">static checks</a> provide strong guarantees about the correctness of the program at compile time. </p><p>Function arguments can be defined as patterns as follows: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">area</span> <span class="p">(</span><span class="n">Circle</span> <span class="p">(_,</span> <span class="n">r</span><span class="p">))</span> <span class="p">=</span> <span class="nn">Math</span><span class="p">.</span><span class="n">pi</span> <span class="n">*</span> <span class="n">square</span> <span class="n">r</span> <span class="p">|</span> <span class="nf">area</span> <span class="p">(</span><span class="n">Square</span> <span class="p">(_,</span> <span class="n">s</span><span class="p">))</span> <span class="p">=</span> <span class="n">square</span> <span class="n">s</span> <span class="p">|</span> <span class="nf">area</span> <span class="p">(</span><span class="n">Triangle</span> <span class="n">p</span><span class="p">)</span> <span class="p">=</span> <span class="n">heron</span> <span class="n">p</span> <span class="cm">(* see above *)</span> </pre></div> <p>The so-called "clausal form" of function definition, where arguments are defined as patterns, is merely <a href="/wiki/Syntactic_sugar" title="Syntactic sugar">syntactic sugar</a> for a case expression: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">area</span> <span class="n">shape</span> <span class="p">=</span> <span class="kr">case</span> <span class="n">shape</span> <span class="kr">of</span> <span class="n">Circle</span> <span class="p">(_,</span> <span class="n">r</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="nn">Math</span><span class="p">.</span><span class="n">pi</span> <span class="n">*</span> <span class="n">square</span> <span class="n">r</span> <span class="n">|</span> <span class="n">Square</span> <span class="p">(_,</span> <span class="n">s</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="n">square</span> <span class="n">s</span> <span class="n">|</span> <span class="n">Triangle</span> <span class="n">p</span> <span class="p">=&gt;</span> <span class="n">heron</span> <span class="n">p</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Exhaustiveness_checking">Exhaustiveness checking</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=11" title="Edit section: Exhaustiveness checking"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Pattern-exhaustiveness checking will make sure that each constructor of the datatype is matched by at least one pattern. </p><p>The following pattern is not exhaustive: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">center</span> <span class="p">(</span><span class="n">Circle</span> <span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="p">_))</span> <span class="p">=</span> <span class="n">c</span> <span class="p">|</span> <span class="nf">center</span> <span class="p">(</span><span class="n">Square</span> <span class="p">((</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">s</span><span class="p">))</span> <span class="p">=</span> <span class="p">(</span><span class="n">x</span> <span class="n">+</span> <span class="n">s</span> <span class="n">/</span> <span class="mf">2.0</span><span class="p">,</span> <span class="n">y</span> <span class="n">+</span> <span class="n">s</span> <span class="n">/</span> <span class="mf">2.0</span><span class="p">)</span> </pre></div> <p>There is no pattern for the <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">Triangle</code> case in the <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">center</code> function. The compiler will issue a warning that the case expression is not exhaustive, and if a <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">Triangle</code> is passed to this function at runtime, <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">exception</span> <span class="nc">Match</span></code> will be raised. </p> <div class="mw-heading mw-heading4"><h4 id="Redundancy_checking">Redundancy checking</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=12" title="Edit section: Redundancy checking"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The pattern in the second clause of the following (meaningless) function is redundant: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">f</span> <span class="p">(</span><span class="n">Circle</span> <span class="p">((</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">r</span><span class="p">))</span> <span class="p">=</span> <span class="n">x</span> <span class="n">+</span> <span class="n">y</span> <span class="p">|</span> <span class="nf">f</span> <span class="p">(</span><span class="n">Circle</span> <span class="p">_)</span> <span class="p">=</span> <span class="mf">1.0</span> <span class="p">|</span> <span class="nf">f</span> <span class="p">_</span> <span class="p">=</span> <span class="mf">0.0</span> </pre></div> <p>Any value that would match the pattern in the second clause would also match the pattern in the first clause, so the second clause is unreachable. Therefore, this definition as a whole exhibits redundancy, and causes a compile-time warning. </p><p>The following function definition is exhaustive and not redundant: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">val</span> <span class="nv">hasCorners</span> <span class="p">=</span> <span class="kr">fn</span> <span class="p">(</span><span class="n">Circle</span> <span class="p">_)</span> <span class="p">=&gt;</span> <span class="n">false</span> <span class="n">|</span> <span class="p">_</span> <span class="p">=&gt;</span> <span class="n">true</span> </pre></div> <p>If control gets past the first pattern (<code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">Circle</code>), we know the shape must be either a <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">Square</code> or a <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">Triangle</code>. In either of those cases, we know the shape has corners, so we can return <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="n">true</span></code> without discerning the actual shape. </p> <div class="mw-heading mw-heading3"><h3 id="Higher-order_functions">Higher-order functions</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=13" title="Edit section: Higher-order functions"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Functions can consume functions as arguments: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">map</span> <span class="n">f</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="p">=</span> <span class="p">(</span><span class="n">f</span> <span class="n">x</span><span class="p">,</span> <span class="n">f</span> <span class="n">y</span><span class="p">)</span> </pre></div> <p>Functions can produce functions as return values: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">constant</span> <span class="n">k</span> <span class="p">=</span> <span class="p">(</span><span class="kr">fn</span> <span class="p">_</span> <span class="p">=&gt;</span> <span class="n">k</span><span class="p">)</span> </pre></div> <p>Functions can also both consume and produce functions: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">compose</span> <span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">g</span><span class="p">)</span> <span class="p">=</span> <span class="p">(</span><span class="kr">fn</span> <span class="n">x</span> <span class="p">=&gt;</span> <span class="n">f</span> <span class="p">(</span><span class="n">g</span> <span class="n">x</span><span class="p">))</span> </pre></div> <p>The function <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">List.map</code> from the basis <a href="/wiki/Library_(computing)" title="Library (computing)">library</a> is one of the most commonly used higher-order functions in Standard ML: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">map</span> <span class="p">_</span> <span class="p">[]</span> <span class="p">=</span> <span class="p">[]</span> <span class="p">|</span> <span class="nf">map</span> <span class="n">f</span> <span class="p">(</span><span class="n">x</span> <span class="n">::</span> <span class="n">xs</span><span class="p">)</span> <span class="p">=</span> <span class="n">f</span> <span class="n">x</span> <span class="n">::</span> <span class="n">map</span> <span class="n">f</span> <span class="n">xs</span> </pre></div> <p>A more efficient implementation with tail-recursive <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">List.foldl</code>: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">map</span> <span class="n">f</span> <span class="p">=</span> <span class="nn">List</span><span class="p">.</span><span class="n">rev</span> <span class="n">o</span> <span class="nn">List</span><span class="p">.</span><span class="n">foldl</span> <span class="p">(</span><span class="kr">fn</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">acc</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="n">f</span> <span class="n">x</span> <span class="n">::</span> <span class="n">acc</span><span class="p">)</span> <span class="p">[]</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Exceptions">Exceptions</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=14" title="Edit section: Exceptions"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Exceptions are raised with the keyword <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">raise</span></code> and handled with the pattern matching <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">handle</span></code> construct. The exception system can implement <a href="/w/index.php?title=Non-local_exit&amp;action=edit&amp;redlink=1" class="new" title="Non-local exit (page does not exist)">non-local exit</a>; this optimization technique is suitable for functions like the following. </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">local</span> <span class="kr">exception</span> <span class="nc">Zero</span><span class="p">;</span> <span class="kr">val</span> <span class="nv">p</span> <span class="p">=</span> <span class="kr">fn</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="p">_)</span> <span class="p">=&gt;</span> <span class="kr">raise</span> <span class="n">Zero</span> <span class="n">|</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="n">a</span> <span class="n">*</span> <span class="n">b</span> <span class="kr">in</span> <span class="kr">fun</span> <span class="nf">prod</span> <span class="n">xs</span> <span class="p">=</span> <span class="nn">List</span><span class="p">.</span><span class="n">foldl</span> <span class="n">p</span> <span class="mi">1</span> <span class="n">xs</span> <span class="kr">handle</span> <span class="n">Zero</span> <span class="p">=&gt;</span> <span class="mi">0</span> <span class="kr">end</span> </pre></div> <p>When <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">exception</span> <span class="nc">Zero</span></code> is raised, control leaves the function <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="nn">List</span><span class="p">.</span><span class="n">foldl</span></code> altogether. Consider the alternative: the value 0 would be returned, it would be multiplied by the next integer in the list, the resulting value (inevitably 0) would be returned, and so on. The raising of the exception allows control to skip over the entire chain of frames and avoid the associated computation. Note the use of the underscore (<code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">_</code>) as a wildcard pattern. </p><p>The same optimization can be obtained with a <a href="/wiki/Tail_call" title="Tail call">tail call</a>. </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">local</span> <span class="kr">fun</span> <span class="nf">p</span> <span class="n">a</span> <span class="p">(</span><span class="mi">0</span> <span class="n">::</span> <span class="p">_)</span> <span class="p">=</span> <span class="mi">0</span> <span class="p">|</span> <span class="nf">p</span> <span class="n">a</span> <span class="p">(</span><span class="n">x</span> <span class="n">::</span> <span class="n">xs</span><span class="p">)</span> <span class="p">=</span> <span class="n">p</span> <span class="p">(</span><span class="n">a</span> <span class="n">*</span> <span class="n">x</span><span class="p">)</span> <span class="n">xs</span> <span class="p">|</span> <span class="nf">p</span> <span class="n">a</span> <span class="p">[]</span> <span class="p">=</span> <span class="n">a</span> <span class="kr">in</span> <span class="kr">val</span> <span class="nv">prod</span> <span class="p">=</span> <span class="n">p</span> <span class="mi">1</span> <span class="kr">end</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Module_system">Module system</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=15" title="Edit section: Module system"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Standard ML's advanced module system allows programs to be decomposed into hierarchically organized <i>structures</i> of logically related type and value definitions. Modules provide not only <a href="/wiki/Namespace" title="Namespace">namespace</a> control but also abstraction, in the sense that they allow the definition of <a href="/wiki/Abstract_data_type" title="Abstract data type">abstract data types</a>. Three main syntactic constructs comprise the module system: signatures, structures and functors. </p> <div class="mw-heading mw-heading4"><h4 id="Signatures">Signatures</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=16" title="Edit section: Signatures"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A <i>signature</i> is an <a href="/wiki/Interface_(computing)" title="Interface (computing)">interface</a>, usually thought of as a type for a structure; it specifies the names of all entities provided by the structure, the <a href="/wiki/Arity" title="Arity">arity</a> of each type component, the type of each value component, and the signature of each substructure. The definitions of type components are optional; type components whose definitions are hidden are <i>abstract types</i>. </p><p>For example, the signature for a <a href="/wiki/Queue_(data_structure)" class="mw-redirect" title="Queue (data structure)">queue</a> may be: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">signature</span> <span class="nn">QUEUE</span> <span class="p">=</span> <span class="kr">sig</span> <span class="kr">type</span> <span class="nd">&#39;a</span> <span class="kt">queue</span> <span class="kr">exception</span> <span class="nc">QueueError</span><span class="p">;</span> <span class="kr">val</span> <span class="nv">empty</span> <span class="p">:</span> <span class="nd">&#39;a</span> <span class="n">queue</span> <span class="kr">val</span> <span class="nv">isEmpty</span> <span class="p">:</span> <span class="nd">&#39;a</span> <span class="n">queue</span> <span class="p">-&gt;</span> <span class="n">bool</span> <span class="kr">val</span> <span class="nv">singleton</span> <span class="p">:</span> <span class="nd">&#39;a</span> <span class="p">-&gt;</span> <span class="nd">&#39;a</span> <span class="n">queue</span> <span class="kr">val</span> <span class="nv">fromList</span> <span class="p">:</span> <span class="nd">&#39;a</span> <span class="n">list</span> <span class="p">-&gt;</span> <span class="nd">&#39;a</span> <span class="n">queue</span> <span class="kr">val</span> <span class="nv">insert</span> <span class="p">:</span> <span class="nd">&#39;a</span> <span class="n">*</span> <span class="nd">&#39;a</span> <span class="n">queue</span> <span class="p">-&gt;</span> <span class="nd">&#39;a</span> <span class="n">queue</span> <span class="kr">val</span> <span class="nv">peek</span> <span class="p">:</span> <span class="nd">&#39;a</span> <span class="n">queue</span> <span class="p">-&gt;</span> <span class="nd">&#39;a</span> <span class="kr">val</span> <span class="nv">remove</span> <span class="p">:</span> <span class="nd">&#39;a</span> <span class="n">queue</span> <span class="p">-&gt;</span> <span class="nd">&#39;a</span> <span class="n">*</span> <span class="nd">&#39;a</span> <span class="n">queue</span> <span class="kr">end</span> </pre></div> <p>This signature describes a module that provides a polymorphic type <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="nd">&#39;a</span> <span class="n">queue</span></code>, <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">exception</span> <span class="nc">QueueError</span></code>, and values that define basic operations on queues. </p> <div class="mw-heading mw-heading4"><h4 id="Structures">Structures</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=17" title="Edit section: Structures"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A <i>structure</i> is a module; it consists of a collection of types, exceptions, values and structures (called <i>substructures</i>) packaged together into a logical unit. </p><p>A queue structure can be implemented as follows: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">structure</span> <span class="nn">TwoListQueue</span> <span class="p">:&gt;</span> <span class="n">QUEUE</span> <span class="p">=</span> <span class="kr">struct</span> <span class="kr">type</span> <span class="nd">&#39;a</span> <span class="kt">queue</span> <span class="p">=</span> <span class="nd">&#39;a</span> <span class="n">list</span> <span class="n">*</span> <span class="nd">&#39;a</span> <span class="n">list</span> <span class="kr">exception</span> <span class="nc">QueueError</span><span class="p">;</span> <span class="kr">val</span> <span class="nv">empty</span> <span class="p">=</span> <span class="p">([],</span> <span class="p">[])</span> <span class="kr">fun</span> <span class="nf">isEmpty</span> <span class="p">([],</span> <span class="p">[])</span> <span class="p">=</span> <span class="n">true</span> <span class="p">|</span> <span class="nf">isEmpty</span> <span class="p">_</span> <span class="p">=</span> <span class="n">false</span> <span class="kr">fun</span> <span class="nf">singleton</span> <span class="n">a</span> <span class="p">=</span> <span class="p">([],</span> <span class="p">[</span><span class="n">a</span><span class="p">])</span> <span class="kr">fun</span> <span class="nf">fromList</span> <span class="n">a</span> <span class="p">=</span> <span class="p">([],</span> <span class="n">a</span><span class="p">)</span> <span class="kr">fun</span> <span class="nf">insert</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">([],</span> <span class="p">[]))</span> <span class="p">=</span> <span class="n">singleton</span> <span class="n">a</span> <span class="p">|</span> <span class="nf">insert</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">(</span><span class="n">ins</span><span class="p">,</span> <span class="n">outs</span><span class="p">))</span> <span class="p">=</span> <span class="p">(</span><span class="n">a</span> <span class="n">::</span> <span class="n">ins</span><span class="p">,</span> <span class="n">outs</span><span class="p">)</span> <span class="kr">fun</span> <span class="nf">peek</span> <span class="p">(_,</span> <span class="p">[])</span> <span class="p">=</span> <span class="kr">raise</span> <span class="n">QueueError</span> <span class="p">|</span> <span class="nf">peek</span> <span class="p">(</span><span class="n">ins</span><span class="p">,</span> <span class="n">outs</span><span class="p">)</span> <span class="p">=</span> <span class="nn">List</span><span class="p">.</span><span class="n">hd</span> <span class="n">outs</span> <span class="kr">fun</span> <span class="nf">remove</span> <span class="p">(_,</span> <span class="p">[])</span> <span class="p">=</span> <span class="kr">raise</span> <span class="n">QueueError</span> <span class="p">|</span> <span class="nf">remove</span> <span class="p">(</span><span class="n">ins</span><span class="p">,</span> <span class="p">[</span><span class="n">a</span><span class="p">])</span> <span class="p">=</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">([],</span> <span class="nn">List</span><span class="p">.</span><span class="n">rev</span> <span class="n">ins</span><span class="p">))</span> <span class="p">|</span> <span class="nf">remove</span> <span class="p">(</span><span class="n">ins</span><span class="p">,</span> <span class="n">a</span> <span class="n">::</span> <span class="n">outs</span><span class="p">)</span> <span class="p">=</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">(</span><span class="n">ins</span><span class="p">,</span> <span class="n">outs</span><span class="p">))</span> <span class="kr">end</span> </pre></div> <p>This definition declares that <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">structure</span> <span class="nn">TwoListQueue</span></code> implements <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">signature</span> <span class="nn">QUEUE</span></code>. Furthermore, the <i>opaque ascription</i> denoted by <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="p">:&gt;</span></code> states that any types which are not defined in the signature (i.e. <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">type</span> <span class="nd">&#39;a</span> <span class="kt">queue</span></code>) should be abstract, meaning that the definition of a queue as a pair of lists is not visible outside the module. The structure implements all of the definitions in the signature. </p><p>The types and values in a structure can be accessed with "dot notation": </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">val</span> <span class="nv">q</span> <span class="p">:</span> <span class="n">string</span> <span class="nn">TwoListQueue</span><span class="p">.</span><span class="n">queue</span> <span class="p">=</span> <span class="nn">TwoListQueue</span><span class="p">.</span><span class="n">empty</span> <span class="kr">val</span> <span class="nv">q&#39;</span> <span class="p">=</span> <span class="nn">TwoListQueue</span><span class="p">.</span><span class="n">insert</span> <span class="p">(</span><span class="nn">Real</span><span class="p">.</span><span class="n">toString</span> <span class="nn">Math</span><span class="p">.</span><span class="n">pi</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Functors">Functors</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=18" title="Edit section: Functors"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A <i>functor</i> is a function from structures to structures; that is, a functor accepts one or more arguments, which are usually structures of a given signature, and produces a structure as its result. Functors are used to implement <a href="/wiki/Generic_programming" title="Generic programming">generic</a> data structures and algorithms. </p><p>One popular algorithm<sup id="cite_ref-bfs_6-0" class="reference"><a href="#cite_note-bfs-6"><span class="cite-bracket">&#91;</span>6<span class="cite-bracket">&#93;</span></a></sup> for <a href="/wiki/Breadth-first_search" title="Breadth-first search">breadth-first search</a> of trees makes use of queues. Here is a version of that algorithm parameterized over an abstract queue structure: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="cm">(* after Okasaki, ICFP, 2000 *)</span> <span class="kr">functor</span> <span class="nn">BFS</span> <span class="p">(</span><span class="n">Q</span><span class="p">:</span> <span class="n">QUEUE</span><span class="p">)</span> <span class="p">=</span> <span class="kr">struct</span> <span class="kr">datatype</span> <span class="nd">&#39;a</span> <span class="kt">tree</span> <span class="p">=</span> <span class="nc">E</span> <span class="p">|</span> <span class="nc">T</span> <span class="kr">of</span> <span class="nd">&#39;a</span> <span class="n">*</span> <span class="nd">&#39;a</span> <span class="n">tree</span> <span class="n">*</span> <span class="nd">&#39;a</span> <span class="n">tree</span> <span class="kr">local</span> <span class="kr">fun</span> <span class="nf">bfsQ</span> <span class="n">q</span> <span class="p">=</span> <span class="kr">if</span> <span class="nn">Q</span><span class="p">.</span><span class="n">isEmpty</span> <span class="n">q</span> <span class="kr">then</span> <span class="p">[]</span> <span class="kr">else</span> <span class="n">search</span> <span class="p">(</span><span class="nn">Q</span><span class="p">.</span><span class="n">remove</span> <span class="n">q</span><span class="p">)</span> <span class="kr">and</span> <span class="nf">search</span> <span class="p">(</span><span class="n">E</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span> <span class="p">=</span> <span class="n">bfsQ</span> <span class="n">q</span> <span class="p">|</span> <span class="nf">search</span> <span class="p">(</span><span class="n">T</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">l</span><span class="p">,</span> <span class="n">r</span><span class="p">),</span> <span class="n">q</span><span class="p">)</span> <span class="p">=</span> <span class="n">x</span> <span class="n">::</span> <span class="n">bfsQ</span> <span class="p">(</span><span class="n">insert</span> <span class="p">(</span><span class="n">insert</span> <span class="n">q</span> <span class="n">l</span><span class="p">)</span> <span class="n">r</span><span class="p">)</span> <span class="kr">and</span> <span class="nf">insert</span> <span class="n">q</span> <span class="n">a</span> <span class="p">=</span> <span class="nn">Q</span><span class="p">.</span><span class="n">insert</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span> <span class="kr">in</span> <span class="kr">fun</span> <span class="nf">bfs</span> <span class="n">t</span> <span class="p">=</span> <span class="n">bfsQ</span> <span class="p">(</span><span class="nn">Q</span><span class="p">.</span><span class="n">singleton</span> <span class="n">t</span><span class="p">)</span> <span class="kr">end</span> <span class="kr">end</span> <span class="kr">structure</span> <span class="nn">QueueBFS</span> <span class="p">=</span> <span class="n">BFS</span> <span class="p">(</span><span class="n">TwoListQueue</span><span class="p">)</span> </pre></div> <p>Within <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">functor</span> <span class="nn">BFS</span></code>, the representation of the queue is not visible. More concretely, there is no way to select the first list in the two-list queue, if that is indeed the representation being used. This <a href="/wiki/Data_abstraction" class="mw-redirect" title="Data abstraction">data abstraction</a> mechanism makes the breadth-first search truly agnostic to the queue's implementation. This is in general desirable; in this case, the queue structure can safely maintain any logical invariants on which its correctness depends behind the bulletproof wall of abstraction. </p> <div class="mw-heading mw-heading2"><h2 id="Code_examples">Code examples</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=19" title="Edit section: Code examples"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1235681985">.mw-parser-output .side-box{margin:4px 0;box-sizing:border-box;border:1px solid #aaa;font-size:88%;line-height:1.25em;background-color:var(--background-color-interactive-subtle,#f8f9fa);display:flow-root}.mw-parser-output .side-box-abovebelow,.mw-parser-output .side-box-text{padding:0.25em 0.9em}.mw-parser-output .side-box-image{padding:2px 0 2px 0.9em;text-align:center}.mw-parser-output .side-box-imageright{padding:2px 0.9em 2px 0;text-align:center}@media(min-width:500px){.mw-parser-output .side-box-flex{display:flex;align-items:center}.mw-parser-output .side-box-text{flex:1;min-width:0}}@media(min-width:720px){.mw-parser-output .side-box{width:238px}.mw-parser-output .side-box-right{clear:right;float:right;margin-left:1em}.mw-parser-output .side-box-left{margin-right:1em}}</style><style data-mw-deduplicate="TemplateStyles:r1237033735">@media print{body.ns-0 .mw-parser-output .sistersitebox{display:none!important}}@media screen{html.skin-theme-clientpref-night .mw-parser-output .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"]{background-color:white}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"]{background-color:white}}</style><div class="side-box side-box-right plainlinks sistersitebox"><style data-mw-deduplicate="TemplateStyles:r1126788409">.mw-parser-output .plainlist ol,.mw-parser-output .plainlist ul{line-height:inherit;list-style:none;margin:0;padding:0}.mw-parser-output .plainlist ol li,.mw-parser-output .plainlist ul li{margin-bottom:0}</style> <div class="side-box-flex"> <div class="side-box-image"><span class="noviewer" typeof="mw:File"><a href="/wiki/File:Wikibooks-logo-en-noslogan.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/40px-Wikibooks-logo-en-noslogan.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/60px-Wikibooks-logo-en-noslogan.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/120px-Wikibooks-logo-en-noslogan.svg.png 2x" data-file-width="400" data-file-height="400" /></a></span></div> <div class="side-box-text plainlist">Wikibooks has a book on the topic of: <i><b><a href="https://en.wikibooks.org/wiki/Standard_ML_Programming" class="extiw" title="wikibooks:Standard ML Programming">Standard ML Programming</a></b></i></div></div> </div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1251242444" /><table class="box-Unreferenced_section plainlinks metadata ambox ambox-content ambox-Unreferenced" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><a href="/wiki/File:Question_book-new.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/50px-Question_book-new.svg.png" decoding="async" width="50" height="39" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/75px-Question_book-new.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/100px-Question_book-new.svg.png 2x" data-file-width="512" data-file-height="399" /></a></span></div></td><td class="mbox-text"><div class="mbox-text-span">This section <b>does not <a href="/wiki/Wikipedia:Citing_sources" title="Wikipedia:Citing sources">cite</a> any <a href="/wiki/Wikipedia:Verifiability" title="Wikipedia:Verifiability">sources</a></b>.<span class="hide-when-compact"> Please help <a href="/wiki/Special:EditPage/Standard_ML" title="Special:EditPage/Standard ML">improve this section</a> by <a href="/wiki/Help:Referencing_for_beginners" title="Help:Referencing for beginners">adding citations to reliable sources</a>. Unsourced material may be challenged and <a href="/wiki/Wikipedia:Verifiability#Burden_of_evidence" title="Wikipedia:Verifiability">removed</a>.</span> <span class="date-container"><i>(<span class="date">June 2013</span>)</i></span><span class="hide-when-compact"><i> (<small><a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove this message</a></small>)</i></span></div></td></tr></tbody></table> <p>Snippets of SML code are most easily studied by entering them into an <a href="/wiki/Read%E2%80%93eval%E2%80%93print_loop" title="Read–eval–print loop">interactive top-level</a>. </p> <div class="mw-heading mw-heading3"><h3 id="Hello,_world!"><span id="Hello.2C_world.21"></span>Hello, world!</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=20" title="Edit section: Hello, world!"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The following is a <a href="/wiki/%22Hello,_World!%22_program" title="&quot;Hello, World!&quot; program">"Hello, World!" program</a>: </p> <table class="wikitable"> <tbody><tr> <th>hello.sml </th></tr> <tr> <td> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr mw-highlight-lines" dir="ltr"><pre><span></span><span class="linenos" data-line="1"></span><span class="n">print</span> <span class="s2">&quot;Hello, world!</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">;</span> </pre></div> </td></tr> <tr> <th>sh </th></tr> <tr> <td> <div class="mw-highlight mw-highlight-lang-console mw-content-ltr" dir="ltr"><pre><span></span><span class="gp">$ </span>mlton<span class="w"> </span>hello.sml <span class="gp">$ </span>./hello <span class="go">Hello, world!</span> </pre></div> </td></tr></tbody></table> <div class="mw-heading mw-heading3"><h3 id="Algorithms">Algorithms</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=21" title="Edit section: Algorithms"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-heading mw-heading4"><h4 id="Insertion_sort">Insertion sort</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=22" title="Edit section: Insertion sort"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Insertion sort for <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="n">int</span> <span class="n">list</span></code> (ascending) can be expressed concisely as follows: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">insert</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="p">[])</span> <span class="p">=</span> <span class="p">[</span><span class="n">x</span><span class="p">]</span> <span class="p">|</span> <span class="nf">insert</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">h</span> <span class="n">::</span> <span class="n">t</span><span class="p">)</span> <span class="p">=</span> <span class="n">sort</span> <span class="n">x</span> <span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="n">t</span><span class="p">)</span> <span class="kr">and</span> <span class="nf">sort</span> <span class="n">x</span> <span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="n">t</span><span class="p">)</span> <span class="p">=</span> <span class="kr">if</span> <span class="n">x</span> <span class="n">&lt;</span> <span class="n">h</span> <span class="kr">then</span> <span class="p">[</span><span class="n">x</span><span class="p">,</span> <span class="n">h</span><span class="p">]</span> <span class="n">@</span> <span class="n">t</span> <span class="kr">else</span> <span class="n">h</span> <span class="n">::</span> <span class="n">insert</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">t</span><span class="p">)</span> <span class="kr">val</span> <span class="nv">insertionsort</span> <span class="p">=</span> <span class="nn">List</span><span class="p">.</span><span class="n">foldl</span> <span class="n">insert</span> <span class="p">[]</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Mergesort">Mergesort</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=23" title="Edit section: Mergesort"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1236090951">.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}</style><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Merge_sort" title="Merge sort">Merge sort</a></div> <p>Here, the classic mergesort algorithm is implemented in three functions: split, merge and mergesort. Also note the absence of types, with the exception of the syntax <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">op</span> <span class="n">::</span></code> and <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="p">[]</span></code> which signify lists. This code will sort lists of any type, so long as a consistent ordering function <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">cmp</code> is defined. Using <a href="/wiki/Hindley%E2%80%93Milner_type_inference" class="mw-redirect" title="Hindley–Milner type inference">Hindley–Milner type inference</a>, the types of all variables can be inferred, even complicated types such as that of the function <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">cmp</code>. </p><p><b>Split</b> </p><p><code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">fun</span> <span class="nf">split</span></code> is implemented with a <a href="/wiki/State_(computer_science)" title="State (computer science)">stateful</a> closure which alternates between <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">true</code> and <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">false</code>, ignoring the input: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">alternator</span> <span class="p">{}</span> <span class="p">=</span> <span class="kr">let</span> <span class="kr">val</span> <span class="nv">state</span> <span class="p">=</span> <span class="n">ref</span> <span class="n">true</span> <span class="kr">in</span> <span class="kr">fn</span> <span class="n">a</span> <span class="p">=&gt;</span> <span class="n">!state</span> <span class="n">before</span> <span class="n">state</span> <span class="n">:=</span> <span class="n">not</span> <span class="p">(</span><span class="n">!state</span><span class="p">)</span> <span class="kr">end</span> <span class="cm">(* Split a list into near-halves which will either be the same length,</span> <span class="cm"> * or the first will have one more element than the other.</span> <span class="cm"> * Runs in O(n) time, where n = |xs|.</span> <span class="cm"> *)</span> <span class="kr">fun</span> <span class="nf">split</span> <span class="n">xs</span> <span class="p">=</span> <span class="nn">List</span><span class="p">.</span><span class="n">partition</span> <span class="p">(</span><span class="n">alternator</span> <span class="p">{})</span> <span class="n">xs</span> </pre></div> <p><b>Merge</b> </p><p>Merge uses a local function loop for efficiency. The inner <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">loop</code> is defined in terms of cases: when both lists are non-empty (<code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="n">x</span> <span class="n">::</span> <span class="n">xs</span></code>) and when one list is empty (<code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="p">[]</span></code>). </p><p>This function merges two sorted lists into one sorted list. Note how the accumulator <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">acc</code> is built backwards, then reversed before being returned. This is a common technique, since <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="nd">&#39;a</span> <span class="n">list</span></code> is represented as a <a href="/wiki/Linked_list#Linked_lists_vs._dynamic_arrays" title="Linked list">linked list</a>; this technique requires more clock time, but the <a href="/wiki/Asymptotic_analysis#Applications" title="Asymptotic analysis">asymptotics</a> are not worse. </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="cm">(* Merge two ordered lists using the order cmp.</span> <span class="cm"> * Pre: each list must already be ordered per cmp.</span> <span class="cm"> * Runs in O(n) time, where n = |xs| + |ys|.</span> <span class="cm"> *)</span> <span class="kr">fun</span> <span class="nf">merge</span> <span class="n">cmp</span> <span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="p">[])</span> <span class="p">=</span> <span class="n">xs</span> <span class="p">|</span> <span class="nf">merge</span> <span class="n">cmp</span> <span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="n">y</span> <span class="n">::</span> <span class="n">ys</span><span class="p">)</span> <span class="p">=</span> <span class="kr">let</span> <span class="kr">fun</span> <span class="nf">loop</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">acc</span><span class="p">)</span> <span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="p">[])</span> <span class="p">=</span> <span class="nn">List</span><span class="p">.</span><span class="n">revAppend</span> <span class="p">(</span><span class="n">a</span> <span class="n">::</span> <span class="n">acc</span><span class="p">,</span> <span class="n">xs</span><span class="p">)</span> <span class="p">|</span> <span class="nf">loop</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">acc</span><span class="p">)</span> <span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="n">y</span> <span class="n">::</span> <span class="n">ys</span><span class="p">)</span> <span class="p">=</span> <span class="kr">if</span> <span class="n">cmp</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="kr">then</span> <span class="n">loop</span> <span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="n">a</span> <span class="n">::</span> <span class="n">acc</span><span class="p">)</span> <span class="p">(</span><span class="n">ys</span><span class="p">,</span> <span class="n">xs</span><span class="p">)</span> <span class="kr">else</span> <span class="n">loop</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">y</span> <span class="n">::</span> <span class="n">acc</span><span class="p">)</span> <span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="n">ys</span><span class="p">)</span> <span class="kr">in</span> <span class="n">loop</span> <span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="p">[])</span> <span class="p">(</span><span class="n">ys</span><span class="p">,</span> <span class="n">xs</span><span class="p">)</span> <span class="kr">end</span> </pre></div> <p><b>Mergesort</b> </p><p>The main function: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">fun</span> <span class="nf">ap</span> <span class="n">f</span> <span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="p">=</span> <span class="p">(</span><span class="n">f</span> <span class="n">x</span><span class="p">,</span> <span class="n">f</span> <span class="n">y</span><span class="p">)</span> <span class="cm">(* Sort a list in according to the given ordering operation cmp.</span> <span class="cm"> * Runs in O(n log n) time, where n = |xs|.</span> <span class="cm"> *)</span> <span class="kr">fun</span> <span class="nf">mergesort</span> <span class="n">cmp</span> <span class="p">[]</span> <span class="p">=</span> <span class="p">[]</span> <span class="p">|</span> <span class="nf">mergesort</span> <span class="n">cmp</span> <span class="p">[</span><span class="n">x</span><span class="p">]</span> <span class="p">=</span> <span class="p">[</span><span class="n">x</span><span class="p">]</span> <span class="p">|</span> <span class="nf">mergesort</span> <span class="n">cmp</span> <span class="n">xs</span> <span class="p">=</span> <span class="p">(</span><span class="n">merge</span> <span class="n">cmp</span> <span class="n">o</span> <span class="n">ap</span> <span class="p">(</span><span class="n">mergesort</span> <span class="n">cmp</span><span class="p">)</span> <span class="n">o</span> <span class="n">split</span><span class="p">)</span> <span class="n">xs</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Quicksort">Quicksort</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=24" title="Edit section: Quicksort"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951" /><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Quicksort" title="Quicksort">Quicksort</a></div> <p>Quicksort can be expressed as follows. <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">fun</span> <span class="nf">part</span></code> is a <a href="/wiki/Closure_(computer_programming)" title="Closure (computer programming)">closure</a> that consumes an order operator <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">op</span> <span class="n">&lt;&lt;</span></code>. </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">infix</span> <span class="n">&lt;&lt;</span> <span class="kr">fun</span> <span class="nf">quicksort</span> <span class="p">(</span><span class="kr">op</span> <span class="n">&lt;&lt;</span><span class="p">)</span> <span class="p">=</span> <span class="kr">let</span> <span class="kr">fun</span> <span class="nf">part</span> <span class="n">p</span> <span class="p">=</span> <span class="nn">List</span><span class="p">.</span><span class="n">partition</span> <span class="p">(</span><span class="kr">fn</span> <span class="n">x</span> <span class="p">=&gt;</span> <span class="n">x</span> <span class="n">&lt;&lt;</span> <span class="n">p</span><span class="p">)</span> <span class="kr">fun</span> <span class="nf">sort</span> <span class="p">[]</span> <span class="p">=</span> <span class="p">[]</span> <span class="p">|</span> <span class="nf">sort</span> <span class="p">(</span><span class="n">p</span> <span class="n">::</span> <span class="n">xs</span><span class="p">)</span> <span class="p">=</span> <span class="n">join</span> <span class="n">p</span> <span class="p">(</span><span class="n">part</span> <span class="n">p</span> <span class="n">xs</span><span class="p">)</span> <span class="kr">and</span> <span class="nf">join</span> <span class="n">p</span> <span class="p">(</span><span class="n">l</span><span class="p">,</span> <span class="n">r</span><span class="p">)</span> <span class="p">=</span> <span class="n">sort</span> <span class="n">l</span> <span class="n">@</span> <span class="n">p</span> <span class="n">::</span> <span class="n">sort</span> <span class="n">r</span> <span class="kr">in</span> <span class="n">sort</span> <span class="kr">end</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Expression_interpreter">Expression interpreter</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=25" title="Edit section: Expression interpreter"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Note the relative ease with which a small expression language can be defined and processed: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">exception</span> <span class="nc">TyErr</span><span class="p">;</span> <span class="kr">datatype</span> <span class="kt">ty</span> <span class="p">=</span> <span class="nc">IntTy</span> <span class="p">|</span> <span class="nc">BoolTy</span> <span class="kr">fun</span> <span class="nf">unify</span> <span class="p">(</span><span class="n">IntTy</span><span class="p">,</span> <span class="n">IntTy</span><span class="p">)</span> <span class="p">=</span> <span class="n">IntTy</span> <span class="p">|</span> <span class="nf">unify</span> <span class="p">(</span><span class="n">BoolTy</span><span class="p">,</span> <span class="n">BoolTy</span><span class="p">)</span> <span class="p">=</span> <span class="n">BoolTy</span> <span class="p">|</span> <span class="nf">unify</span> <span class="p">(_,</span> <span class="p">_)</span> <span class="p">=</span> <span class="kr">raise</span> <span class="n">TyErr</span> <span class="kr">datatype</span> <span class="kt">exp</span> <span class="p">=</span> <span class="nc">True</span> <span class="p">|</span> <span class="nc">False</span> <span class="p">|</span> <span class="nc">Int</span> <span class="kr">of</span> <span class="n">int</span> <span class="p">|</span> <span class="nc">Not</span> <span class="kr">of</span> <span class="n">exp</span> <span class="p">|</span> <span class="nc">Add</span> <span class="kr">of</span> <span class="n">exp</span> <span class="n">*</span> <span class="n">exp</span> <span class="p">|</span> <span class="nc">If</span> <span class="kr">of</span> <span class="n">exp</span> <span class="n">*</span> <span class="n">exp</span> <span class="n">*</span> <span class="n">exp</span> <span class="kr">fun</span> <span class="nf">infer</span> <span class="n">True</span> <span class="p">=</span> <span class="n">BoolTy</span> <span class="p">|</span> <span class="nf">infer</span> <span class="n">False</span> <span class="p">=</span> <span class="n">BoolTy</span> <span class="p">|</span> <span class="nf">infer</span> <span class="p">(</span><span class="n">Int</span> <span class="p">_)</span> <span class="p">=</span> <span class="n">IntTy</span> <span class="p">|</span> <span class="nf">infer</span> <span class="p">(</span><span class="n">Not</span> <span class="n">e</span><span class="p">)</span> <span class="p">=</span> <span class="p">(</span><span class="n">assert</span> <span class="n">e</span> <span class="n">BoolTy</span><span class="p">;</span> <span class="n">BoolTy</span><span class="p">)</span> <span class="p">|</span> <span class="nf">infer</span> <span class="p">(</span><span class="n">Add</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">))</span> <span class="p">=</span> <span class="p">(</span><span class="n">assert</span> <span class="n">a</span> <span class="n">IntTy</span><span class="p">;</span> <span class="n">assert</span> <span class="n">b</span> <span class="n">IntTy</span><span class="p">;</span> <span class="n">IntTy</span><span class="p">)</span> <span class="p">|</span> <span class="nf">infer</span> <span class="p">(</span><span class="n">If</span> <span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">t</span><span class="p">,</span> <span class="n">f</span><span class="p">))</span> <span class="p">=</span> <span class="p">(</span><span class="n">assert</span> <span class="n">e</span> <span class="n">BoolTy</span><span class="p">;</span> <span class="n">unify</span> <span class="p">(</span><span class="n">infer</span> <span class="n">t</span><span class="p">,</span> <span class="n">infer</span> <span class="n">f</span><span class="p">))</span> <span class="kr">and</span> <span class="nf">assert</span> <span class="n">e</span> <span class="n">t</span> <span class="p">=</span> <span class="n">unify</span> <span class="p">(</span><span class="n">infer</span> <span class="n">e</span><span class="p">,</span> <span class="n">t</span><span class="p">)</span> <span class="kr">fun</span> <span class="nf">eval</span> <span class="n">True</span> <span class="p">=</span> <span class="n">True</span> <span class="p">|</span> <span class="nf">eval</span> <span class="n">False</span> <span class="p">=</span> <span class="n">False</span> <span class="p">|</span> <span class="nf">eval</span> <span class="p">(</span><span class="n">Int</span> <span class="n">n</span><span class="p">)</span> <span class="p">=</span> <span class="n">Int</span> <span class="n">n</span> <span class="p">|</span> <span class="nf">eval</span> <span class="p">(</span><span class="n">Not</span> <span class="n">e</span><span class="p">)</span> <span class="p">=</span> <span class="kr">if</span> <span class="n">eval</span> <span class="n">e</span> <span class="p">=</span> <span class="n">True</span> <span class="kr">then</span> <span class="n">False</span> <span class="kr">else</span> <span class="n">True</span> <span class="p">|</span> <span class="nf">eval</span> <span class="p">(</span><span class="n">Add</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">))</span> <span class="p">=</span> <span class="p">(</span><span class="kr">case</span> <span class="p">(</span><span class="n">eval</span> <span class="n">a</span><span class="p">,</span> <span class="n">eval</span> <span class="n">b</span><span class="p">)</span> <span class="kr">of</span> <span class="p">(</span><span class="n">Int</span> <span class="n">x</span><span class="p">,</span> <span class="n">Int</span> <span class="n">y</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="n">Int</span> <span class="p">(</span><span class="n">x</span> <span class="n">+</span> <span class="n">y</span><span class="p">))</span> <span class="p">|</span> <span class="nf">eval</span> <span class="p">(</span><span class="n">If</span> <span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">t</span><span class="p">,</span> <span class="n">f</span><span class="p">))</span> <span class="p">=</span> <span class="n">eval</span> <span class="p">(</span><span class="kr">if</span> <span class="n">eval</span> <span class="n">e</span> <span class="p">=</span> <span class="n">True</span> <span class="kr">then</span> <span class="n">t</span> <span class="kr">else</span> <span class="n">f</span><span class="p">)</span> <span class="kr">fun</span> <span class="nf">run</span> <span class="n">e</span> <span class="p">=</span> <span class="p">(</span><span class="n">infer</span> <span class="n">e</span><span class="p">;</span> <span class="n">SOME</span> <span class="p">(</span><span class="n">eval</span> <span class="n">e</span><span class="p">))</span> <span class="kr">handle</span> <span class="n">TyErr</span> <span class="p">=&gt;</span> <span class="n">NONE</span> </pre></div> <p>Example usage on well-typed and ill-typed expressions: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="kr">val</span> <span class="nv">SOME</span> <span class="p">(</span><span class="n">Int</span> <span class="mi">3</span><span class="p">)</span> <span class="p">=</span> <span class="n">run</span> <span class="p">(</span><span class="n">Add</span> <span class="p">(</span><span class="n">Int</span> <span class="mi">1</span><span class="p">,</span> <span class="n">Int</span> <span class="mi">2</span><span class="p">))</span> <span class="cm">(* well-typed *)</span> <span class="kr">val</span> <span class="nv">NONE</span> <span class="p">=</span> <span class="n">run</span> <span class="p">(</span><span class="n">If</span> <span class="p">(</span><span class="n">Not</span> <span class="p">(</span><span class="n">Int</span> <span class="mi">1</span><span class="p">),</span> <span class="n">True</span><span class="p">,</span> <span class="n">False</span><span class="p">))</span> <span class="cm">(* ill-typed *)</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Arbitrary-precision_integers">Arbitrary-precision integers</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=26" title="Edit section: Arbitrary-precision integers"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">IntInf</code> module provides arbitrary-precision integer arithmetic. Moreover, integer literals may be used as arbitrary-precision integers without the programmer having to do anything. </p><p>The following program implements an arbitrary-precision factorial function: </p> <table class="wikitable"> <tbody><tr> <th>fact.sml </th></tr> <tr> <td> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr mw-highlight-lines" dir="ltr"><pre><span></span><span class="linenos" data-line="1"></span><span class="kr">fun</span> <span class="nf">fact</span> <span class="n">n</span> <span class="p">:</span> <span class="nn">IntInf</span><span class="p">.</span><span class="n">int</span> <span class="p">=</span> <span class="kr">if</span> <span class="n">n</span> <span class="p">=</span> <span class="mi">0</span> <span class="kr">then</span> <span class="mi">1</span> <span class="kr">else</span> <span class="n">n</span> <span class="n">*</span> <span class="n">fact</span> <span class="p">(</span><span class="n">n</span> <span class="n">-</span> <span class="mi">1</span><span class="p">);</span> <span class="linenos" data-line="2"></span> <span class="linenos" data-line="3"></span><span class="kr">fun</span> <span class="nf">printLine</span> <span class="n">str</span> <span class="p">=</span> <span class="nn">TextIO</span><span class="p">.</span><span class="n">output</span> <span class="p">(</span><span class="nn">TextIO</span><span class="p">.</span><span class="n">stdOut</span><span class="p">,</span> <span class="n">str</span> <span class="n">^</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">);</span> <span class="linenos" data-line="4"></span> <span class="linenos" data-line="5"></span><span class="kr">val</span> <span class="p">()</span> <span class="nv">=</span> <span class="n">printLine</span> <span class="p">(</span><span class="nn">IntInf</span><span class="p">.</span><span class="n">toString</span> <span class="p">(</span><span class="n">fact</span> <span class="mi">120</span><span class="p">));</span> </pre></div> </td></tr> <tr> <th>bash </th></tr> <tr> <td> <div class="mw-highlight mw-highlight-lang-console mw-content-ltr" dir="ltr"><pre><span></span><span class="gp">$ </span>mlton<span class="w"> </span>fact.sml <span class="gp">$ </span>./fact <span class="go">6689502913449127057588118054090372586752746333138029810295671352301</span> <span class="go">6335572449629893668741652719849813081576378932140905525344085894081</span> <span class="go">21859898481114389650005964960521256960000000000000000000000000000</span> </pre></div> </td></tr></tbody></table> <div class="mw-heading mw-heading3"><h3 id="Partial_application">Partial application</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=27" title="Edit section: Partial application"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Curried functions have many applications, such as eliminating redundant code. For example, a module may require functions of type <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="n">a</span> <span class="p">-&gt;</span> <span class="n">b</span></code>, but it is more convenient to write functions of type <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="n">a</span> <span class="n">*</span> <span class="n">c</span> <span class="p">-&gt;</span> <span class="n">b</span></code> where there is a fixed relationship between the objects of type <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">a</code> and <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">c</code>. A function of type <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="n">c</span> <span class="p">-&gt;</span> <span class="p">(</span><span class="n">a</span> <span class="n">*</span> <span class="n">c</span> <span class="p">-&gt;</span> <span class="n">b</span><span class="p">)</span> <span class="p">-&gt;</span> <span class="n">a</span> <span class="p">-&gt;</span> <span class="n">b</span></code> can factor out this commonality. This is an example of the <a href="/wiki/Adapter_pattern" title="Adapter pattern">adapter pattern</a>.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (May 2015)">citation needed</span></a></i>&#93;</sup> </p><p>In this example, <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">fun</span> <span class="nf">d</span></code> computes the numerical derivative of a given function <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">f</code> at point <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">x</code>: </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="hll"><span class="n">-</span> <span class="kr">fun</span> <span class="nf">d</span> <span class="n">delta</span> <span class="n">f</span> <span class="n">x</span> <span class="p">=</span> <span class="p">(</span><span class="n">f</span> <span class="p">(</span><span class="n">x</span> <span class="n">+</span> <span class="n">delta</span><span class="p">)</span> <span class="n">-</span> <span class="n">f</span> <span class="p">(</span><span class="n">x</span> <span class="n">-</span> <span class="n">delta</span><span class="p">))</span> <span class="n">/</span> <span class="p">(</span><span class="mf">2.0</span> <span class="n">*</span> <span class="n">delta</span><span class="p">)</span> </span><span class="kr">val</span> <span class="nv">d</span> <span class="p">=</span> <span class="kr">fn</span> <span class="p">:</span> <span class="n">real</span> <span class="p">-&gt;</span> <span class="p">(</span><span class="n">real</span> <span class="p">-&gt;</span> <span class="n">real</span><span class="p">)</span> <span class="p">-&gt;</span> <span class="n">real</span> <span class="p">-&gt;</span> <span class="n">real</span> </pre></div> <p>The type of <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="kr">fun</span> <span class="nf">d</span></code> indicates that it maps a "float" onto a function with the type <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="p">(</span><span class="n">real</span> <span class="p">-&gt;</span> <span class="n">real</span><span class="p">)</span> <span class="p">-&gt;</span> <span class="n">real</span> <span class="p">-&gt;</span> <span class="n">real</span></code>. This allows us to partially apply arguments, known as <a href="/wiki/Currying" title="Currying">currying</a>. In this case, function <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">d</code> can be specialised by partially applying it with the argument <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">delta</code>. A good choice for <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">delta</code> when using this algorithm is the cube root of the <a href="/wiki/Machine_epsilon" title="Machine epsilon">machine epsilon</a>.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (August 2008)">citation needed</span></a></i>&#93;</sup> </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="hll"><span class="n">-</span> <span class="kr">val</span> <span class="nv">d&#39;</span> <span class="p">=</span> <span class="n">d</span> <span class="mf">1E~8</span><span class="p">;</span> </span><span class="kr">val</span> <span class="nv">d&#39;</span> <span class="p">=</span> <span class="kr">fn</span> <span class="p">:</span> <span class="p">(</span><span class="n">real</span> <span class="p">-&gt;</span> <span class="n">real</span><span class="p">)</span> <span class="p">-&gt;</span> <span class="n">real</span> <span class="p">-&gt;</span> <span class="n">real</span> </pre></div> <p>The inferred type indicates that <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">d&#39;</code> expects a function with the type <code class="mw-highlight mw-highlight-lang-sml mw-content-ltr" style="" dir="ltr"><span class="n">real</span> <span class="p">-&gt;</span> <span class="n">real</span></code> as its first argument. We can compute an approximation to the derivative of <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f(x)=x^{3}-x-1}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>f</mi> <mo stretchy="false">(</mo> <mi>x</mi> <mo stretchy="false">)</mo> <mo>=</mo> <msup> <mi>x</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>3</mn> </mrow> </msup> <mo>&#x2212;<!-- − --></mo> <mi>x</mi> <mo>&#x2212;<!-- − --></mo> <mn>1</mn> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle f(x)=x^{3}-x-1}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/1168fe8be3d478e75505c2a35c865e48e112c4b5" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:18.073ex; height:3.176ex;" alt="{\displaystyle f(x)=x^{3}-x-1}" /></span> at <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle x=3}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>x</mi> <mo>=</mo> <mn>3</mn> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle x=3}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/871a5063af170fa536b144fbcc5745146a42cc13" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.591ex; height:2.176ex;" alt="{\displaystyle x=3}" /></span>. The correct answer is <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f'(3)=27-1=26}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msup> <mi>f</mi> <mo>&#x2032;</mo> </msup> <mo stretchy="false">(</mo> <mn>3</mn> <mo stretchy="false">)</mo> <mo>=</mo> <mn>27</mn> <mo>&#x2212;<!-- − --></mo> <mn>1</mn> <mo>=</mo> <mn>26</mn> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle f'(3)=27-1=26}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/5ab36e829bece8e8b70171f894c867efc74005d5" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:19.827ex; height:3.009ex;" alt="{\displaystyle f&#39;(3)=27-1=26}" /></span>. </p> <div class="mw-highlight mw-highlight-lang-sml mw-content-ltr" dir="ltr"><pre><span></span><span class="hll"><span class="n">-</span> <span class="n">d&#39;</span> <span class="p">(</span><span class="kr">fn</span> <span class="n">x</span> <span class="p">=&gt;</span> <span class="n">x</span> <span class="n">*</span> <span class="n">x</span> <span class="n">*</span> <span class="n">x</span> <span class="n">-</span> <span class="n">x</span> <span class="n">-</span> <span class="mf">1.0</span><span class="p">)</span> <span class="mf">3.0</span><span class="p">;</span> </span><span class="kr">val</span> <span class="nv">it</span> <span class="p">=</span> <span class="mf">25.9999996644</span> <span class="p">:</span> <span class="n">real</span> </pre></div> <div class="mw-heading mw-heading2"><h2 id="Libraries">Libraries</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=28" title="Edit section: Libraries"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-heading mw-heading3"><h3 id="Standard">Standard</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=29" title="Edit section: Standard"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The Basis Library<sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">&#91;</span>7<span class="cite-bracket">&#93;</span></a></sup> has been standardized and ships with most implementations. It provides modules for trees, arrays, and other data structures, and <a href="/wiki/Input/output" title="Input/output">input/output</a> and system interfaces. </p> <div class="mw-heading mw-heading3"><h3 id="Third_party">Third party</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=30" title="Edit section: Third party"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>For <a href="/wiki/Numerical_analysis" title="Numerical analysis">numerical computing</a>, a Matrix module exists (but is currently broken), <a rel="nofollow" class="external free" href="https://www.cs.cmu.edu/afs/cs/project/pscico/pscico/src/matrix/README.html">https://www.cs.cmu.edu/afs/cs/project/pscico/pscico/src/matrix/README.html</a>. </p><p>For graphics, cairo-sml is an open source interface to the <a href="/wiki/Cairo_(graphics)" title="Cairo (graphics)">Cairo</a> graphics library. For machine learning, a library for graphical models exists. </p> <div class="mw-heading mw-heading2"><h2 id="Implementations">Implementations</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=31" title="Edit section: Implementations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Implementations of Standard ML include the following: </p><p><b>Standard</b> </p> <ul><li><a rel="nofollow" class="external text" href="https://www.mpi-sws.org/~rossberg/hamlet/">HaMLet</a>: a Standard ML interpreter that aims to be an accurate and accessible reference implementation of the standard</li> <li><a href="/wiki/MLton" title="MLton">MLton</a> (<a rel="nofollow" class="external text" href="http://www.mlton.org">mlton.org</a>): a <a href="/wiki/Interprocedural_optimization" title="Interprocedural optimization">whole-program optimizing</a> compiler which strictly conforms to the Definition and produces very fast code compared to other ML implementations, including <a href="/wiki/Compiler#Back_end" title="Compiler">backends</a> for <a href="/wiki/LLVM" title="LLVM">LLVM</a> and C</li> <li><a rel="nofollow" class="external text" href="http://www.itu.dk/people/sestoft/mosml.html">Moscow ML</a>: a light-weight implementation, based on the <a href="/wiki/Caml" title="Caml">Caml</a> Light runtime engine which implements the full Standard ML language, including modules and much of the basis library</li> <li><a rel="nofollow" class="external text" href="http://www.polyml.org/">Poly/ML</a>: a full implementation of Standard ML that produces fast code and supports multicore hardware (via Portable Operating System Interface (<a href="/wiki/POSIX" title="POSIX">POSIX</a>) threads); its runtime system performs parallel <a href="/wiki/Garbage_collection_(computer_science)" title="Garbage collection (computer science)">garbage collection</a> and online sharing of immutable substructures.</li> <li><a href="/wiki/Standard_ML_of_New_Jersey" title="Standard ML of New Jersey">Standard ML of New Jersey</a> (<a rel="nofollow" class="external text" href="http://www.smlnj.org/">smlnj.org</a>): a full compiler, with associated libraries, tools, an interactive shell, and documentation with support for <a href="/wiki/Concurrent_ML" title="Concurrent ML">Concurrent ML</a></li> <li><a rel="nofollow" class="external text" href="http://www.cl.cam.ac.uk/Research/TSG/SMLNET/">SML.NET</a>: a Standard ML compiler for the <a href="/wiki/Common_Language_Runtime" title="Common Language Runtime">Common Language Runtime</a> with extensions for linking with other <a href="/wiki/.NET" title=".NET">.NET</a> framework code</li> <li><a rel="nofollow" class="external text" href="http://www.elsman.com/mlkit/">ML Kit</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20160107005413/http://www.elsman.com/mlkit/">Archived</a> 2016-01-07 at the <a href="/wiki/Wayback_Machine" title="Wayback Machine">Wayback Machine</a>: an implementation based very closely on the Definition, integrating a garbage collector (which can be disabled) and <a href="/wiki/Region-based_memory_management" title="Region-based memory management">region-based memory management</a> with automatic inference of regions, aiming to support real-time applications</li></ul> <p><b>Derivative</b> </p> <ul><li><a href="/wiki/Alice_(programming_language)" title="Alice (programming language)">Alice</a>: an interpreter for Standard ML by Saarland University with support for parallel programming using <a href="/wiki/Futures_and_promises" title="Futures and promises">futures</a>, <a href="/wiki/Lazy_evaluation" title="Lazy evaluation">lazy evaluation</a>, <a href="/wiki/Distributed_computing" title="Distributed computing">distributed computing</a> via <a href="/wiki/Remote_procedure_call" title="Remote procedure call">remote procedure calls</a> and <a href="/wiki/Constraint_programming" title="Constraint programming">constraint programming</a></li> <li><a rel="nofollow" class="external text" href="http://www.pllab.riec.tohoku.ac.jp/smlsharp/">SML#</a>: an extension of SML providing record polymorphism and C language interoperability. It is a conventional native compiler and its name is <i>not</i> an allusion to running on the .NET framework</li> <li><a rel="nofollow" class="external text" href="https://github.com/SOSML/SOSML">SOSML</a>: an implementation written in <a href="/wiki/TypeScript" title="TypeScript">TypeScript</a>, supporting most of the SML language and select parts of the basis library</li></ul> <p><b>Research</b> </p> <ul><li><a rel="nofollow" class="external text" href="https://cakeml.org/">CakeML</a> is a REPL version of ML with formally verified runtime and translation to assembler.</li> <li><a href="/wiki/Isabelle_(proof_assistant)" title="Isabelle (proof assistant)">Isabelle</a> (<a rel="nofollow" class="external text" href="https://isabelle.in.tum.de">Isabelle/ML</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20200830080049/http://isabelle.in.tum.de/">Archived</a> 2020-08-30 at the <a href="/wiki/Wayback_Machine" title="Wayback Machine">Wayback Machine</a>) integrates parallel Poly/ML into an interactive theorem prover, with a sophisticated IDE (based on <a href="/wiki/JEdit" title="JEdit">jEdit</a>) for official Standard ML (SML'97), the Isabelle/ML dialect, and the proof language. Starting with Isabelle2016, there is also a source-level debugger for ML.</li> <li><a href="/wiki/Poplog" title="Poplog">Poplog</a> implements a version of Standard ML, along with <a href="/wiki/Common_Lisp" title="Common Lisp">Common Lisp</a> and <a href="/wiki/Prolog" title="Prolog">Prolog</a>, allowing mixed language programming; all are implemented in <a href="/wiki/POP-11" title="POP-11">POP-11</a>, which is <a href="/wiki/Incremental_compiler" title="Incremental compiler">compiled incrementally</a>.</li> <li><a rel="nofollow" class="external text" href="http://www.cs.cornell.edu/home/jgm/tilt.html">TILT</a> is a full certifying compiler for Standard ML which uses typed <a href="/wiki/Intermediate_representation" title="Intermediate representation">intermediate languages</a> to <a href="/wiki/Program_optimization" title="Program optimization">optimize</a> code and ensure correctness, and can compile to <a href="/wiki/Typed_assembly_language" title="Typed assembly language">typed assembly language</a>.</li></ul> <p>All of these implementations are <a href="/wiki/Open-source_license" title="Open-source license">open-source</a> and freely available. Most are implemented themselves in Standard ML. There are no longer any commercial implementations; <a href="/wiki/Harlequin_(software_company)" title="Harlequin (software company)">Harlequin</a>, now defunct, once produced a commercial IDE and compiler called MLWorks which passed on to <a href="/wiki/Xanalys" title="Xanalys">Xanalys</a> and was later open-sourced after it was acquired by Ravenbrook Limited on April 26, 2013. </p> <div class="mw-heading mw-heading2"><h2 id="Major_projects_using_SML">Major projects using SML</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=32" title="Edit section: Major projects using SML"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The <a href="/wiki/IT_University_of_Copenhagen" title="IT University of Copenhagen">IT University of Copenhagen</a>'s entire <a href="/wiki/Enterprise_architecture" title="Enterprise architecture">enterprise architecture</a> is implemented in around 100,000 lines of SML, including staff records, payroll, course administration and feedback, student project management, and web-based self-service interfaces.<sup id="cite_ref-sml_8-0" class="reference"><a href="#cite_note-sml-8"><span class="cite-bracket">&#91;</span>8<span class="cite-bracket">&#93;</span></a></sup> </p><p>The <a href="/wiki/Proof_assistant" title="Proof assistant">proof assistants</a> <a href="/wiki/HOL_(proof_assistant)" title="HOL (proof assistant)">HOL4</a>, <a href="/wiki/Isabelle_(proof_assistant)" title="Isabelle (proof assistant)">Isabelle</a>, <a href="/wiki/LEGO_(proof_assistant)" title="LEGO (proof assistant)">LEGO</a>, and <a href="/wiki/Twelf" title="Twelf">Twelf</a> are written in Standard ML. It is also used by <a href="/wiki/Compiler#Compiler_construction" title="Compiler">compiler writers</a> and <a href="/wiki/Integrated_circuit_design" title="Integrated circuit design">integrated circuit designers</a> such as <a href="/wiki/ARM_architecture" class="mw-redirect" title="ARM architecture">ARM</a>.<sup id="cite_ref-machine_code_verification_9-0" class="reference"><a href="#cite_note-machine_code_verification-9"><span class="cite-bracket">&#91;</span>9<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=33" title="Edit section: See also"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="/wiki/Declarative_programming" title="Declarative programming">Declarative programming</a></li></ul> <div class="mw-heading mw-heading2"><h2 id="References">References</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=34" title="Edit section: References"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1239543626">.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}</style><div class="cite-bracket" style="column-width: &lt;sup id=" id="cite_ref-machine_code_verification_9-1"> <ol class="references"> <li id="cite_note-intro-1"><span class="mw-cite-backlink">^ <a href="#cite_ref-intro_1-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-intro_1-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.cs.cmu.edu/~rwh/introsml/modules/subfun.htm">"Programming in Standard ML: Hierarchies and Parameterization"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">2020-02-22</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Programming+in+Standard+ML%3A+Hierarchies+and+Parameterization&amp;rft_id=https%3A%2F%2Fwww.cs.cmu.edu%2F~rwh%2Fintrosml%2Fmodules%2Fsubfun.htm&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AStandard+ML" class="Z3988"></span></span> </li> <li id="cite_note-smlnj-2"><span class="mw-cite-backlink">^ <a href="#cite_ref-smlnj_2-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-smlnj_2-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-smlnj_2-2"><sup><i><b>c</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.smlnj.org/sml97.html">"SML '97"</a>. <i>www.smlnj.org</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=www.smlnj.org&amp;rft.atitle=SML+%2797&amp;rft_id=http%3A%2F%2Fwww.smlnj.org%2Fsml97.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AStandard+ML" class="Z3988"></span></span> </li> <li id="cite_note-itertools-3"><span class="mw-cite-backlink">^ <a href="#cite_ref-itertools_3-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-itertools_3-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://docs.python.org/3/library/itertools.html">"itertools — Functions creating iterators for efficient looping — Python 3.7.1rc1 documentation"</a>. <i>docs.python.org</i>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=docs.python.org&amp;rft.atitle=itertools+%E2%80%94+Functions+creating+iterators+for+efficient+looping+%E2%80%94+Python+3.7.1rc1+documentation&amp;rft_id=https%3A%2F%2Fdocs.python.org%2F3%2Flibrary%2Fitertools.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AStandard+ML" class="Z3988"></span></span> </li> <li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://doc.rust-lang.org/reference/influences.html">"Influences - The Rust Reference"</a>. <i>The Rust Reference</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2023-12-31</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=The+Rust+Reference&amp;rft.atitle=Influences+-+The+Rust+Reference&amp;rft_id=https%3A%2F%2Fdoc.rust-lang.org%2Freference%2Finfluences.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AStandard+ML" class="Z3988"></span></span> </li> <li id="cite_note-revision-5"><span class="mw-cite-backlink">^ <a href="#cite_ref-revision_5-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-revision_5-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFMilnerTofteHarperMacQueen1997" class="citation book cs1"><a href="/wiki/Robin_Milner" title="Robin Milner">Milner, Robin</a>; Tofte, Mads; Harper, Robert; MacQueen, David (1997). <i>The Definition of Standard ML (Revised)</i>. MIT Press. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&#160;<a href="/wiki/Special:BookSources/0-262-63181-4" title="Special:BookSources/0-262-63181-4"><bdi>0-262-63181-4</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=The+Definition+of+Standard+ML+%28Revised%29&amp;rft.pub=MIT+Press&amp;rft.date=1997&amp;rft.isbn=0-262-63181-4&amp;rft.aulast=Milner&amp;rft.aufirst=Robin&amp;rft.au=Tofte%2C+Mads&amp;rft.au=Harper%2C+Robert&amp;rft.au=MacQueen%2C+David&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AStandard+ML" class="Z3988"></span></span> </li> <li id="cite_note-bfs-6"><span class="mw-cite-backlink">^ <a href="#cite_ref-bfs_6-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-bfs_6-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFOkasaki2000" class="citation conference cs1">Okasaki, Chris (2000). "Breadth-First Numbering: Lessons from a Small Exercise in Algorithm Design". <i>International Conference on Functional Programming 2000</i>. ACM.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=conference&amp;rft.atitle=Breadth-First+Numbering%3A+Lessons+from+a+Small+Exercise+in+Algorithm+Design&amp;rft.btitle=International+Conference+on+Functional+Programming+2000&amp;rft.pub=ACM&amp;rft.date=2000&amp;rft.aulast=Okasaki&amp;rft.aufirst=Chris&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AStandard+ML" class="Z3988"></span></span> </li> <li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://smlfamily.github.io/Basis/index.html">"Standard ML Basis Library"</a>. <i>smlfamily.github.io</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2022-01-10</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=smlfamily.github.io&amp;rft.atitle=Standard+ML+Basis+Library&amp;rft_id=https%3A%2F%2Fsmlfamily.github.io%2FBasis%2Findex.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AStandard+ML" class="Z3988"></span></span> </li> <li id="cite_note-sml-8"><span class="mw-cite-backlink">^ <a href="#cite_ref-sml_8-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-sml_8-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFTofte2009" class="citation journal cs1">Tofte, Mads (2009). <a rel="nofollow" class="external text" href="https://doi.org/10.4249%2Fscholarpedia.7515">"Standard ML language"</a>. <i>Scholarpedia</i>. <b>4</b> (2): 7515. <a href="/wiki/Bibcode_(identifier)" class="mw-redirect" title="Bibcode (identifier)">Bibcode</a>:<a rel="nofollow" class="external text" href="https://ui.adsabs.harvard.edu/abs/2009SchpJ...4.7515T">2009SchpJ...4.7515T</a>. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://doi.org/10.4249%2Fscholarpedia.7515">10.4249/scholarpedia.7515</a></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=article&amp;rft.jtitle=Scholarpedia&amp;rft.atitle=Standard+ML+language&amp;rft.volume=4&amp;rft.issue=2&amp;rft.pages=7515&amp;rft.date=2009&amp;rft_id=info%3Adoi%2F10.4249%2Fscholarpedia.7515&amp;rft_id=info%3Abibcode%2F2009SchpJ...4.7515T&amp;rft.aulast=Tofte&amp;rft.aufirst=Mads&amp;rft_id=https%3A%2F%2Fdoi.org%2F10.4249%252Fscholarpedia.7515&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AStandard+ML" class="Z3988"></span></span> </li> <li id="cite_note-machine_code_verification-9"><span class="mw-cite-backlink">^ <a href="#cite_ref-machine_code_verification_9-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-machine_code_verification_9-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFAlglaveFoxIshtiaqMyreen2009" class="citation conference cs1"><a href="/wiki/Jade_Alglave" title="Jade Alglave">Alglave, Jade</a>; Fox, Anthony C. J.; Ishtiaq, Samin; Myreen, Magnus O.; Sarkar, Susmit; Sewell, Peter; Nardelli, Francesco Zappa (2009). <a rel="nofollow" class="external text" href="http://www0.cs.ucl.ac.uk/staff/j.alglave/papers/damp09.pdf"><i>The Semantics of Power and ARM Multiprocessor Machine Code</i></a> <span class="cs1-format">(PDF)</span>. DAMP 2009. pp.&#160;<span class="nowrap">13–</span>24. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20170814015026/http://www0.cs.ucl.ac.uk/staff/j.alglave/papers/damp09.pdf">Archived</a> <span class="cs1-format">(PDF)</span> from the original on 2017-08-14.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=conference&amp;rft.btitle=The+Semantics+of+Power+and+ARM+Multiprocessor+Machine+Code&amp;rft.pages=%3Cspan+class%3D%22nowrap%22%3E13-%3C%2Fspan%3E24&amp;rft.date=2009&amp;rft.aulast=Alglave&amp;rft.aufirst=Jade&amp;rft.au=Fox%2C+Anthony+C.+J.&amp;rft.au=Ishtiaq%2C+Samin&amp;rft.au=Myreen%2C+Magnus+O.&amp;rft.au=Sarkar%2C+Susmit&amp;rft.au=Sewell%2C+Peter&amp;rft.au=Nardelli%2C+Francesco+Zappa&amp;rft_id=http%3A%2F%2Fwww0.cs.ucl.ac.uk%2Fstaff%2Fj.alglave%2Fpapers%2Fdamp09.pdf&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AStandard+ML" class="Z3988"></span></span> </li> </ol></div> <div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Standard_ML&amp;action=edit&amp;section=35" title="Edit section: External links"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><b>About Standard ML</b> </p> <ul><li><a rel="nofollow" class="external text" href="https://smlfamily.github.io/sml97-defn.pdf">Revised definition</a></li> <li><a rel="nofollow" class="external text" href="http://sml-family.org">Standard ML Family GitHub Project</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20200220023435/http://sml-family.org/">Archived</a> 2020-02-20 at the <a href="/wiki/Wayback_Machine" title="Wayback Machine">Wayback Machine</a></li> <li><a rel="nofollow" class="external text" href="http://www.smlnj.org/sml.html">What is SML?</a></li> <li><a rel="nofollow" class="external text" href="http://www.smlnj.org/sml97.html">What is SML '97?</a></li></ul> <p><b>About successor ML</b> </p> <ul><li><a rel="nofollow" class="external text" href="https://github.com/SMLFamily/Successor-ML">successor ML (sML)</a>: evolution of ML using Standard ML as a starting point</li> <li><a rel="nofollow" class="external text" href="https://github.com/rossberg/hamlet/tree/succ">HaMLet on GitHub</a>: reference implementation for successor ML</li></ul> <p><b>Practical</b> </p> <ul><li><a rel="nofollow" class="external text" href="https://learnxinyminutes.com/docs/standard-ml/">Basic introductory tutorial</a></li> <li><a rel="nofollow" class="external text" href="http://www.rosettacode.org/wiki/Category:Standard_ML">Examples in Rosetta Code</a></li></ul> <p><b>Academic</b> </p> <ul><li><a rel="nofollow" class="external text" href="https://www.cs.cmu.edu/~rwh/isml/book.pdf">Programming in Standard ML</a></li> <li><a rel="nofollow" class="external text" href="http://www.dcs.ed.ac.uk/home/stg/NOTES/notes.html">Programming in Standard ML '97: An Online Tutorial</a></li></ul> <div class="navbox-styles"><style data-mw-deduplicate="TemplateStyles:r1129693374">.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}</style><style data-mw-deduplicate="TemplateStyles:r1236075235">.mw-parser-output .navbox{box-sizing:border-box;border:1px solid #a2a9b1;width:100%;clear:both;font-size:88%;text-align:center;padding:1px;margin:1em auto 0}.mw-parser-output .navbox .navbox{margin-top:0}.mw-parser-output .navbox+.navbox,.mw-parser-output .navbox+.navbox-styles+.navbox{margin-top:-1px}.mw-parser-output .navbox-inner,.mw-parser-output .navbox-subgroup{width:100%}.mw-parser-output .navbox-group,.mw-parser-output .navbox-title,.mw-parser-output .navbox-abovebelow{padding:0.25em 1em;line-height:1.5em;text-align:center}.mw-parser-output .navbox-group{white-space:nowrap;text-align:right}.mw-parser-output .navbox,.mw-parser-output .navbox-subgroup{background-color:#fdfdfd}.mw-parser-output .navbox-list{line-height:1.5em;border-color:#fdfdfd}.mw-parser-output .navbox-list-with-group{text-align:left;border-left-width:2px;border-left-style:solid}.mw-parser-output tr+tr>.navbox-abovebelow,.mw-parser-output tr+tr>.navbox-group,.mw-parser-output tr+tr>.navbox-image,.mw-parser-output tr+tr>.navbox-list{border-top:2px solid #fdfdfd}.mw-parser-output .navbox-title{background-color:#ccf}.mw-parser-output .navbox-abovebelow,.mw-parser-output .navbox-group,.mw-parser-output .navbox-subgroup .navbox-title{background-color:#ddf}.mw-parser-output .navbox-subgroup .navbox-group,.mw-parser-output .navbox-subgroup .navbox-abovebelow{background-color:#e6e6ff}.mw-parser-output .navbox-even{background-color:#f7f7f7}.mw-parser-output .navbox-odd{background-color:transparent}.mw-parser-output .navbox .hlist td dl,.mw-parser-output .navbox .hlist td ol,.mw-parser-output .navbox .hlist td ul,.mw-parser-output .navbox td.hlist dl,.mw-parser-output .navbox td.hlist ol,.mw-parser-output .navbox td.hlist ul{padding:0.125em 0}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}body.skin--responsive .mw-parser-output .navbox-image img{max-width:none!important}@media print{body.ns-0 .mw-parser-output .navbox{display:none!important}}</style></div><div role="navigation" class="navbox" aria-labelledby="ML_programming711" style="padding:3px"><table class="nowraplinks hlist mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="3"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374" /><style data-mw-deduplicate="TemplateStyles:r1239400231">.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}</style><div class="navbar plainlinks hlist navbar-mini"><ul><li class="nv-view"><a href="/wiki/Template:ML_programming" title="Template:ML programming"><abbr title="View this template">v</abbr></a></li><li class="nv-talk"><a href="/w/index.php?title=Template_talk:ML_programming&amp;action=edit&amp;redlink=1" class="new" title="Template talk:ML programming (page does not exist)"><abbr title="Discuss this template">t</abbr></a></li><li class="nv-edit"><a href="/wiki/Special:EditPage/Template:ML_programming" title="Special:EditPage/Template:ML programming"><abbr title="Edit this template">e</abbr></a></li></ul></div><div id="ML_programming711" style="font-size:114%;margin:0 4em"><a href="/wiki/ML_(programming_language)" title="ML (programming language)">ML</a> programming</div></th></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Software" title="Software">Software</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"></div><table class="nowraplinks navbox-subgroup" style="border-spacing:0"><tbody><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Programming_language_implementation" title="Programming language implementation">Implementations</a>,<br /><a href="/wiki/Dialect_(computing)" class="mw-redirect" title="Dialect (computing)">dialects</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"></div><table class="nowraplinks navbox-subgroup" style="border-spacing:0"><tbody><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Caml" title="Caml">Caml</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/OCaml" title="OCaml">OCaml</a>° <ul><li><a href="/wiki/Eff_(programming_language)" title="Eff (programming language)">Eff</a></li> <li><a href="/wiki/F*_(programming_language)" title="F* (programming language)">F*</a>°</li> <li><a href="/wiki/F_Sharp_(programming_language)" title="F Sharp (programming language)">F#</a>°</li> <li><a href="/wiki/JoCaml" title="JoCaml">JoCaml</a>°</li> <li><a href="/wiki/Reason_(programming_language)" title="Reason (programming language)">Reason</a>°</li></ul></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a class="mw-selflink selflink">Standard ML</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><i><a href="/wiki/Alice_(programming_language)" title="Alice (programming language)">Alice</a></i>°</li> <li><a href="/wiki/Concurrent_ML" title="Concurrent ML">Concurrent ML</a></li> <li><a href="/wiki/Extended_ML" title="Extended ML">Extended ML</a></li> <li><a href="/wiki/MLton" title="MLton">MLton</a>°</li> <li><a href="/wiki/Standard_ML_of_New_Jersey" title="Standard ML of New Jersey">Standard ML of New Jersey</a>° (SML/NJ)</li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><i><a href="/wiki/Dependent_ML" title="Dependent ML">Dependent ML</a></i></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/ATS_(programming_language)" title="ATS (programming language)">ATS</a>°</li></ul> </div></td></tr></tbody></table><div> <ul><li><a href="/wiki/Futhark_(programming_language)" title="Futhark (programming language)">Futhark</a>°</li> <li><a href="/wiki/Lennart_Augustsson#Languages" title="Lennart Augustsson">Lazy ML</a></li> <li><a href="/wiki/MacroML" title="MacroML">MacroML</a></li> <li><a href="/wiki/Ur_(programming_language)" title="Ur (programming language)">Ur</a>°</li></ul></div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Programming_tool" title="Programming tool">Programming tools</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <li><a href="/wiki/Alt-Ergo" title="Alt-Ergo">Alt-Ergo</a>°</li> <li><a href="/wiki/Astr%C3%A9e_(static_analysis)" title="Astrée (static analysis)">Astrée</a></li> <li><a href="/wiki/Camlp4" title="Camlp4">Camlp4</a>°</li> <li><a href="/wiki/FFTW" title="FFTW">FFTW</a>°</li> <li><a href="/wiki/Frama-C" title="Frama-C">Frama-C</a>°</li> <li><a href="/wiki/Haxe" title="Haxe">Haxe</a>°</li> <li><a href="/wiki/Marionnet" title="Marionnet">Marionnet</a>°</li> <li><a href="/wiki/MTASC" title="MTASC">MTASC</a>°</li> <li><a href="/wiki/Poplog" title="Poplog">Poplog</a>°</li> <li><a href="/wiki/Semgrep" title="Semgrep">Semgrep</a>°</li> <li><a href="/wiki/SLAM_project" title="SLAM project">SLAM project</a></li> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Automated_theorem_proving" title="Automated theorem proving">Theorem provers</a>,<br /><a href="/wiki/Proof_assistant" title="Proof assistant">proof assistants</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Rocq" title="Rocq">Rocq</a>°</li> <li><a href="/wiki/HOL_(proof_assistant)" title="HOL (proof assistant)">HOL</a>° <ul><li><a href="/wiki/HOL_Light" title="HOL Light">HOL Light</a>°</li></ul></li> <li><a href="/wiki/Isabelle_(proof_assistant)" title="Isabelle (proof assistant)">Isabelle</a>°</li> <li><a href="/wiki/LEGO_(proof_assistant)" title="LEGO (proof assistant)">LEGO</a></li> <li><i><a href="/wiki/Logic_for_Computable_Functions" title="Logic for Computable Functions">Logic for Computable Functions</a></i></li> <li><a href="/wiki/Matita" title="Matita">Matita</a>°</li> <li><a href="/wiki/Twelf" title="Twelf">Twelf</a>°</li></ul> </div></td></tr></tbody></table><div> <ul><li><a href="/wiki/GeneWeb" title="GeneWeb">GeneWeb</a>°</li></ul></div></td><td class="noviewer navbox-image" rowspan="2" style="width:1px;padding:0 0 0 2px"><div><span typeof="mw:File"><a href="/wiki/File:OCaml_Logo.svg" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/f/ff/OCaml_Logo.svg/110px-OCaml_Logo.svg.png" decoding="async" width="110" height="30" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/f/ff/OCaml_Logo.svg/165px-OCaml_Logo.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/f/ff/OCaml_Logo.svg/220px-OCaml_Logo.svg.png 2x" data-file-width="525" data-file-height="144" /></a></span></div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Community_of_practice" title="Community of practice">Community</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"></div><table class="nowraplinks navbox-subgroup" style="border-spacing:0"><tbody><tr><th id="Designers9" scope="row" class="navbox-group" style="width:1%">Designers</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <li><a href="/wiki/Lennart_Augustsson" title="Lennart Augustsson">Lennart Augustsson</a> (Lazy ML)</li> <li><a href="/wiki/Damien_Doligez" title="Damien Doligez">Damien Doligez</a> (OCaml)</li> <li><a href="/wiki/G%C3%A9rard_Huet" title="Gérard Huet">Gérard Huet</a> (Caml)</li> <li><a href="/wiki/Xavier_Leroy" title="Xavier Leroy">Xavier Leroy</a> (Caml, OCaml)</li> <li><a href="/wiki/Robin_Milner" title="Robin Milner">Robin Milner</a> (ML)</li> <li><a href="/wiki/Don_Sannella" title="Don Sannella">Don Sannella</a> (Extended ML)</li> <li><a href="/wiki/Don_Syme" title="Don Syme">Don Syme</a> (F#)</li> </div></td></tr></tbody></table><div> <ul><li><a href="/wiki/Thierry_Coquand" title="Thierry Coquand">Thierry Coquand</a></li> <li><a href="/wiki/Steven_G._Johnson" title="Steven G. Johnson">Steven G. Johnson</a></li> <li><a href="/wiki/Christine_Paulin-Mohring" title="Christine Paulin-Mohring">Christine Paulin-Mohring</a></li> <li><a href="/wiki/Frank_Pfenning" title="Frank Pfenning">Frank Pfenning</a></li> <li><a href="/wiki/Simon_Thompson_(professor)" title="Simon Thompson (professor)">Simon Thompson</a></li></ul></div></td></tr><tr><td class="navbox-abovebelow" colspan="3"><div> <li><i>Italics</i> <b>= discontinued</b></li> <li><b>° = <a href="/wiki/Open-source_software" title="Open-source software">Open-source software</a></b><br /><span class="noviewer" typeof="mw:File"><a href="/wiki/File:Symbol_book_class2.svg" class="mw-file-description" title="Wikipedia book"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_book_class2.svg/20px-Symbol_book_class2.svg.png" decoding="async" width="16" height="16" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_book_class2.svg/40px-Symbol_book_class2.svg.png 1.5x" data-file-width="180" data-file-height="185" /></a></span> <b><a href="https://en.wikibooks.org/wiki/OCaml" class="extiw" title="wikibooks:OCaml">Book</a></b> <span class="noviewer" typeof="mw:File"><span title="Category"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png" decoding="async" width="16" height="16" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/23px-Symbol_category_class.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/31px-Symbol_category_class.svg.png 2x" data-file-width="180" data-file-height="185" /></span></span> <b><a href="/wiki/Category:ML_programming_language_family" title="Category:ML programming language family">Category:Family:ML</a></b> <span class="noviewer" typeof="mw:File"><span title="Category"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png" decoding="async" width="16" height="16" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/23px-Symbol_category_class.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/31px-Symbol_category_class.svg.png 2x" data-file-width="180" data-file-height="185" /></span></span> <b><a href="/wiki/Category:OCaml_programming_language_family" title="Category:OCaml programming language family">Category:Family:OCaml</a></b> <span class="noviewer" typeof="mw:File"><span title="Category"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png" decoding="async" width="16" height="16" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/23px-Symbol_category_class.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/31px-Symbol_category_class.svg.png 2x" data-file-width="180" data-file-height="185" /></span></span> <b><a href="/wiki/Category:OCaml_software" title="Category:OCaml software">Category:Software:OCaml</a></b></li> </div></td></tr></tbody></table></div> <div class="navbox-styles"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374" /><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236075235" /></div><div role="navigation" class="navbox" aria-labelledby="Programming_languages625" style="padding:3px"><table class="nowraplinks hlist mw-collapsible expanded navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374" /><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1239400231" /><div class="navbar plainlinks hlist navbar-mini"><ul><li class="nv-view"><a href="/wiki/Template:Programming_languages" title="Template:Programming languages"><abbr title="View this template">v</abbr></a></li><li class="nv-talk"><a href="/wiki/Template_talk:Programming_languages" title="Template talk:Programming languages"><abbr title="Discuss this template">t</abbr></a></li><li class="nv-edit"><a href="/wiki/Special:EditPage/Template:Programming_languages" title="Special:EditPage/Template:Programming languages"><abbr title="Edit this template">e</abbr></a></li></ul></div><div id="Programming_languages625" style="font-size:114%;margin:0 4em"><a href="/wiki/Programming_language" title="Programming language">Programming languages</a></div></th></tr><tr><td class="navbox-abovebelow" colspan="2"><div> <ul><li><a href="/wiki/Comparison_of_programming_languages" title="Comparison of programming languages">Comparison</a></li> <li><a href="/wiki/Timeline_of_programming_languages" title="Timeline of programming languages">Timeline</a></li> <li><a href="/wiki/History_of_programming_languages" title="History of programming languages">History</a></li></ul> </div></td></tr><tr><td colspan="2" class="navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Ada_(programming_language)" title="Ada (programming language)">Ada</a></li> <li><a href="/wiki/ALGOL" title="ALGOL">ALGOL</a> <ul><li><a href="/wiki/Simula" title="Simula">Simula</a></li></ul></li> <li><a href="/wiki/APL_(programming_language)" title="APL (programming language)">APL</a></li> <li><a href="/wiki/Assembly_language" title="Assembly language">Assembly</a></li> <li><a href="/wiki/BASIC" title="BASIC">BASIC</a> <ul><li><a href="/wiki/Visual_Basic" title="Visual Basic">Visual Basic</a> <ul><li><a href="/wiki/Visual_Basic_(classic)" title="Visual Basic (classic)">classic</a></li> <li><a href="/wiki/Visual_Basic_(.NET)" title="Visual Basic (.NET)">.NET</a></li></ul></li></ul></li> <li><a href="/wiki/C_(programming_language)" title="C (programming language)">C</a></li> <li><a href="/wiki/C%2B%2B" title="C++">C++</a></li> <li><a href="/wiki/C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a></li> <li><a href="/wiki/COBOL" title="COBOL">COBOL</a></li> <li><a href="/wiki/Erlang_(programming_language)" title="Erlang (programming language)">Erlang</a> <ul><li><a href="/wiki/Elixir_(programming_language)" title="Elixir (programming language)">Elixir</a></li></ul></li> <li><a href="/wiki/Forth_(programming_language)" title="Forth (programming language)">Forth</a></li> <li><a href="/wiki/Fortran" title="Fortran">Fortran</a></li> <li><a href="/wiki/Go_(programming_language)" title="Go (programming language)">Go</a></li> <li><a href="/wiki/Haskell" title="Haskell">Haskell</a></li> <li><a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a></li> <li><a href="/wiki/JavaScript" title="JavaScript">JavaScript</a> <ul><li><a href="/wiki/TypeScript" title="TypeScript">TypeScript</a></li></ul></li> <li><a href="/wiki/Julia_(programming_language)" title="Julia (programming language)">Julia</a></li> <li><a href="/wiki/Kotlin_(programming_language)" title="Kotlin (programming language)">Kotlin</a></li> <li><a href="/wiki/Lisp_(programming_language)" title="Lisp (programming language)">Lisp</a></li> <li><a href="/wiki/Lua_(programming_language)" title="Lua (programming language)">Lua</a></li> <li><a href="/wiki/MATLAB" title="MATLAB">MATLAB</a></li> <li><a href="/wiki/ML_(programming_language)" title="ML (programming language)">ML</a> <ul><li><a href="/wiki/Caml" title="Caml">Caml </a> <ul><li><a href="/wiki/OCaml" title="OCaml">OCaml</a></li></ul></li></ul></li> <li><a href="/wiki/Pascal_(programming_language)" title="Pascal (programming language)">Pascal</a> <ul><li><a href="/wiki/Object_Pascal" title="Object Pascal">Object Pascal</a></li></ul></li> <li><a href="/wiki/Perl" title="Perl">Perl </a> <ul><li><a href="/wiki/Raku_(programming_language)" title="Raku (programming language)">Raku</a></li></ul></li> <li><a href="/wiki/PHP" title="PHP">PHP</a></li> <li><a href="/wiki/Prolog" title="Prolog">Prolog</a></li> <li><a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a></li> <li><a href="/wiki/R_(programming_language)" title="R (programming language)">R</a></li> <li><a href="/wiki/Ruby_(programming_language)" title="Ruby (programming language)">Ruby</a></li> <li><a href="/wiki/Rust_(programming_language)" title="Rust (programming language)">Rust</a></li> <li><a href="/wiki/SQL" title="SQL">SQL</a></li> <li><a href="/wiki/Scratch_(programming_language)" title="Scratch (programming language)">Scratch</a></li> <li><a href="/wiki/Shell_script" title="Shell script">Shell</a></li> <li><a href="/wiki/Smalltalk" title="Smalltalk">Smalltalk</a></li> <li><a href="/wiki/Swift_(programming_language)" title="Swift (programming language)">Swift</a></li> <li><i><a href="/wiki/List_of_programming_languages" title="List of programming languages">more...</a></i></li></ul> </div></td></tr><tr><td class="navbox-abovebelow" colspan="2"><div> <ul><li><span class="noviewer" typeof="mw:File"><span title="List-Class article"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/d/db/Symbol_list_class.svg/16px-Symbol_list_class.svg.png" decoding="async" width="16" height="16" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/d/db/Symbol_list_class.svg/23px-Symbol_list_class.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/d/db/Symbol_list_class.svg/31px-Symbol_list_class.svg.png 2x" data-file-width="180" data-file-height="185" /></span></span> <b>Lists:</b> <a href="/wiki/List_of_programming_languages" title="List of programming languages">Alphabetical</a></li> <li><a href="/wiki/List_of_programming_languages_by_type" title="List of programming languages by type">Categorical</a></li> <li><a href="/wiki/Generational_list_of_programming_languages" title="Generational list of programming languages">Generational</a></li> <li><a href="/wiki/Non-English-based_programming_languages" title="Non-English-based programming languages">Non-English-based</a></li> <li><span class="noviewer" typeof="mw:File"><span title="Category"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png" decoding="async" width="16" height="16" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/23px-Symbol_category_class.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/31px-Symbol_category_class.svg.png 2x" data-file-width="180" data-file-height="185" /></span></span> <a href="/wiki/Category:Programming_languages" title="Category:Programming languages">Category</a></li></ul> </div></td></tr></tbody></table></div> <div class="navbox-styles"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374" /><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236075235" /></div><div role="navigation" class="navbox authority-control" aria-label="Navbox390" style="padding:3px"><table class="nowraplinks hlist navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Help:Authority_control" title="Help:Authority control">Authority control databases</a>: National <span class="mw-valign-text-top noprint" typeof="mw:File/Frameless"><a href="https://www.wikidata.org/wiki/Q597330#identifiers" title="Edit this at Wikidata"><img alt="Edit this at Wikidata" src="//upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png" decoding="async" width="10" height="10" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/15px-OOjs_UI_icon_edit-ltr-progressive.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/20px-OOjs_UI_icon_edit-ltr-progressive.svg.png 2x" data-file-width="20" data-file-height="20" /></a></span></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"><ul><li><span class="uid"><a rel="nofollow" class="external text" href="https://d-nb.info/gnd/4295302-9">Germany</a></span></li></ul></div></td></tr></tbody></table></div> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐5c6f46dcf‐nc2x9 Cached time: 20250331025842 Cache expiry: 75691 Reduced expiry: true Complications: [vary‐revision‐sha1, show‐toc] CPU time usage: 0.567 seconds Real time usage: 1.536 seconds Preprocessor visited node count: 4325/1000000 Post‐expand include size: 109395/2097152 bytes Template argument size: 13068/2097152 bytes Highest expansion depth: 22/100 Expensive parser function count: 107/500 Unstrip recursion depth: 1/20 Unstrip post‐expand size: 127291/5000000 bytes Lua time usage: 0.279/10.000 seconds Lua memory usage: 7098239/52428800 bytes Number of Wikibase entities loaded: 1/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 1358.303 1 -total 33.66% 457.268 60 Template:Code 8.34% 113.311 5 Template:Navbox 8.03% 109.040 1 Template:Refs 7.54% 102.455 1 Template:ML_programming 5.44% 73.909 1 Template:Short_description 5.44% 73.856 2 Template:Infobox 5.31% 72.179 5 Template:Cite_web 4.19% 56.849 1 Template:Infobox_programming_language 3.85% 52.231 1 Template:Multiple_issues --> <!-- Saved in parser cache with key enwiki:pcache:100337:|#|:idhash:canonical and timestamp 20250331025842 and revision id 1277968932. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?useformat=desktop&amp;type=1x1&amp;usesul3=0" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://en.wikipedia.org/w/index.php?title=Standard_ML&amp;oldid=1277968932">https://en.wikipedia.org/w/index.php?title=Standard_ML&amp;oldid=1277968932</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Help:Category" title="Help:Category">Categories</a>: <ul><li><a href="/wiki/Category:High-level_programming_languages" title="Category:High-level programming languages">High-level programming languages</a></li><li><a href="/wiki/Category:Functional_languages" title="Category:Functional languages">Functional languages</a></li><li><a href="/wiki/Category:Procedural_programming_languages" title="Category:Procedural programming languages">Procedural programming languages</a></li><li><a href="/wiki/Category:ML_programming_language_family" title="Category:ML programming language family">ML programming language family</a></li><li><a href="/wiki/Category:Programming_languages_created_in_1983" title="Category:Programming languages created in 1983">Programming languages created in 1983</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="/wiki/Category:Articles_with_short_description" title="Category:Articles with short description">Articles with short description</a></li><li><a href="/wiki/Category:Short_description_is_different_from_Wikidata" title="Category:Short description is different from Wikidata">Short description is different from Wikidata</a></li><li><a href="/wiki/Category:Articles_needing_cleanup_from_November_2021" title="Category:Articles needing cleanup from November 2021">Articles needing cleanup from November 2021</a></li><li><a href="/wiki/Category:All_pages_needing_cleanup" title="Category:All pages needing cleanup">All pages needing cleanup</a></li><li><a href="/wiki/Category:Articles_containing_how-to_sections" title="Category:Articles containing how-to sections">Articles containing how-to sections</a></li><li><a href="/wiki/Category:Articles_needing_additional_references_from_November_2021" title="Category:Articles needing additional references from November 2021">Articles needing additional references from November 2021</a></li><li><a href="/wiki/Category:All_articles_needing_additional_references" title="Category:All articles needing additional references">All articles needing additional references</a></li><li><a href="/wiki/Category:Articles_with_multiple_maintenance_issues" title="Category:Articles with multiple maintenance issues">Articles with multiple maintenance issues</a></li><li><a href="/wiki/Category:Articles_needing_additional_references_from_June_2013" title="Category:Articles needing additional references from June 2013">Articles needing additional references from June 2013</a></li><li><a href="/wiki/Category:All_articles_with_unsourced_statements" title="Category:All articles with unsourced statements">All articles with unsourced statements</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_May_2015" title="Category:Articles with unsourced statements from May 2015">Articles with unsourced statements from May 2015</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_August_2008" title="Category:Articles with unsourced statements from August 2008">Articles with unsourced statements from August 2008</a></li><li><a href="/wiki/Category:Webarchive_template_wayback_links" title="Category:Webarchive template wayback links">Webarchive template wayback links</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 27 February 2025, at 19:30<span class="anonymous-show">&#160;(UTC)</span>.</li> <li id="footer-info-copyright">Text is available under the <a href="/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License" title="Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License">Creative Commons Attribution-ShareAlike 4.0 License</a>; additional terms may apply. By using this site, you agree to the <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use" class="extiw" title="foundation:Special:MyLanguage/Policy:Terms of Use">Terms of Use</a> and <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy" class="extiw" title="foundation:Special:MyLanguage/Policy:Privacy policy">Privacy Policy</a>. Wikipedia® is a registered trademark of the <a rel="nofollow" class="external text" href="https://wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, a non-profit organization.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:About">About Wikipedia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:General_disclaimer">Disclaimers</a></li> <li id="footer-places-contact"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/en.wikipedia.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//en.m.wikipedia.org/w/index.php?title=Standard_ML&amp;mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://www.wikimedia.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><picture><source media="(min-width: 500px)" srcset="/static/images/footer/wikimedia-button.svg" width="84" height="29"><img src="/static/images/footer/wikimedia.svg" width="25" height="25" alt="Wikimedia Foundation" lang="en" loading="lazy"></picture></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><picture><source media="(min-width: 500px)" srcset="/w/resources/assets/poweredby_mediawiki.svg" width="88" height="31"><img src="/w/resources/assets/mediawiki_compact.svg" alt="Powered by MediaWiki" lang="en" width="25" height="25" loading="lazy"></picture></a></li> </ul> </footer> </div> </div> </div> <div class="vector-header-container vector-sticky-header-container"> <div id="vector-sticky-header" class="vector-sticky-header"> <div class="vector-sticky-header-start"> <div class="vector-sticky-header-icon-start vector-button-flush-left vector-button-flush-right" aria-hidden="true"> <button class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-sticky-header-search-toggle" tabindex="-1" data-event-name="ui.vector-sticky-search-form.icon"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </button> </div> <div role="search" class="vector-search-box-vue vector-search-box-show-thumbnail vector-search-box"> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail"> <form action="/w/index.php" id="vector-sticky-search-form" class="cdx-search-input cdx-search-input--has-end-button"> <div class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia"> <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <div class="vector-sticky-header-context-bar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-sticky-header-toc" class="vector-dropdown mw-portlet mw-portlet-sticky-header-toc vector-sticky-header-toc vector-button-flush-left" > <input type="checkbox" id="vector-sticky-header-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-sticky-header-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-sticky-header-toc-label" for="vector-sticky-header-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-sticky-header-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div class="vector-sticky-header-context-bar-primary" aria-hidden="true" ><span class="mw-page-title-main">Standard ML</span></div> </div> </div> <div class="vector-sticky-header-end" aria-hidden="true"> <div class="vector-sticky-header-icons"> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-talk-sticky-header" tabindex="-1" data-event-name="talk-sticky-header"><span class="vector-icon mw-ui-icon-speechBubbles mw-ui-icon-wikimedia-speechBubbles"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-subject-sticky-header" tabindex="-1" data-event-name="subject-sticky-header"><span class="vector-icon mw-ui-icon-article mw-ui-icon-wikimedia-article"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-history-sticky-header" tabindex="-1" data-event-name="history-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-history mw-ui-icon-wikimedia-wikimedia-history"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only mw-watchlink" id="ca-watchstar-sticky-header" tabindex="-1" data-event-name="watch-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-star mw-ui-icon-wikimedia-wikimedia-star"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-edit-sticky-header" tabindex="-1" data-event-name="wikitext-edit-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-wikiText mw-ui-icon-wikimedia-wikimedia-wikiText"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-ve-edit-sticky-header" tabindex="-1" data-event-name="ve-edit-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-edit mw-ui-icon-wikimedia-wikimedia-edit"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-viewsource-sticky-header" tabindex="-1" data-event-name="ve-edit-protected-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-editLock mw-ui-icon-wikimedia-wikimedia-editLock"></span> <span></span> </a> </div> <div class="vector-sticky-header-buttons"> <button class="cdx-button cdx-button--weight-quiet mw-interlanguage-selector" id="p-lang-btn-sticky-header" tabindex="-1" data-event-name="ui.dropdown-p-lang-btn-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-language mw-ui-icon-wikimedia-wikimedia-language"></span> <span>23 languages</span> </button> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive" id="ca-addsection-sticky-header" tabindex="-1" data-event-name="addsection-sticky-header"><span class="vector-icon mw-ui-icon-speechBubbleAdd-progressive mw-ui-icon-wikimedia-speechBubbleAdd-progressive"></span> <span>Add topic</span> </a> </div> <div class="vector-sticky-header-icon-end"> <div class="vector-user-links"> </div> </div> </div> </div> </div> <div class="mw-portlet mw-portlet-dock-bottom emptyPortlet" id="p-dock-bottom"> <ul> </ul> </div> <script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-5c6f46dcf-fsm4g","wgBackendResponseTime":195,"wgPageParseReport":{"limitreport":{"cputime":"0.567","walltime":"1.536","ppvisitednodes":{"value":4325,"limit":1000000},"postexpandincludesize":{"value":109395,"limit":2097152},"templateargumentsize":{"value":13068,"limit":2097152},"expansiondepth":{"value":22,"limit":100},"expensivefunctioncount":{"value":107,"limit":500},"unstrip-depth":{"value":1,"limit":20},"unstrip-size":{"value":127291,"limit":5000000},"entityaccesscount":{"value":1,"limit":400},"timingprofile":["100.00% 1358.303 1 -total"," 33.66% 457.268 60 Template:Code"," 8.34% 113.311 5 Template:Navbox"," 8.03% 109.040 1 Template:Refs"," 7.54% 102.455 1 Template:ML_programming"," 5.44% 73.909 1 Template:Short_description"," 5.44% 73.856 2 Template:Infobox"," 5.31% 72.179 5 Template:Cite_web"," 4.19% 56.849 1 Template:Infobox_programming_language"," 3.85% 52.231 1 Template:Multiple_issues"]},"scribunto":{"limitreport-timeusage":{"value":"0.279","limit":"10.000"},"limitreport-memusage":{"value":7098239,"limit":52428800}},"cachereport":{"origin":"mw-web.codfw.main-5c6f46dcf-nc2x9","timestamp":"20250331025842","ttl":75691,"transientcontent":true}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Standard ML","url":"https:\/\/en.wikipedia.org\/wiki\/Standard_ML","sameAs":"http:\/\/www.wikidata.org\/entity\/Q597330","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q597330","author":{"@type":"Organization","name":"Contributors to Wikimedia projects"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2002-10-07T04:36:05Z","dateModified":"2025-02-27T19:30:38Z","headline":"programming language"}</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10