CINXE.COM
Type algébrique de données — Wikipédia
<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-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-toc-available" lang="fr" dir="ltr"> <head> <meta charset="UTF-8"> <title>Type algébrique de données — Wikipédia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-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-toc-available";var cookie=document.cookie.match(/(?:^|; )frwikimwclientpreferences=([^;]+)/);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":[",\t."," \t,"],"wgDigitTransformTable":["",""], "wgDefaultDateFormat":"dmy","wgMonthNames":["","janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],"wgRequestId":"16472348-6796-4d7c-a383-b84e7f23e48f","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Type_algébrique_de_données","wgTitle":"Type algébrique de données","wgCurRevisionId":217277222,"wgRevisionId":217277222,"wgArticleId":1014977,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Wikipédia:ébauche informatique","Article contenant un appel à traduction en anglais","Article avec une section vide ou incomplète","Portail:Programmation informatique/Articles liés","Portail:Informatique/Articles liés","Programmation fonctionnelle","Théorie des types"],"wgPageViewLanguage":"fr","wgPageContentLanguage":"fr","wgPageContentModel":"wikitext","wgRelevantPageName":"Type_algébrique_de_données", "wgRelevantArticleId":1014977,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":true,"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"fr","pageLanguageDir":"ltr","pageVariantFallbacks":"fr"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":true,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":20000,"wgRelatedArticlesCompat":[],"wgCentralAuthMobileDomain":false,"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q1322511","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics" :true,"wgGETopicsMatchModeEnabled":false,"wgGEStructuredTaskRejectionReasonTextInputEnabled":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","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["ext.cite.ux-enhancements","ext.pygments.view","site","mediawiki.page.ready","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.ArchiveLinks","ext.gadget.Wdsearch","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.growthExperiments.SuggestedEditSession","wikibase.sidebar.tracking"];</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=fr&modules=ext.cite.styles%7Cext.pygments%2CwikimediaBadges%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022"> <script async="" src="/w/load.php?lang=fr&modules=startup&only=scripts&raw=1&skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=fr&modules=site.styles&only=styles&skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.4"> <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="Type algébrique de données — Wikipédia"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//fr.m.wikipedia.org/wiki/Type_alg%C3%A9brique_de_donn%C3%A9es"> <link rel="alternate" type="application/x-wiki" title="Modifier" href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&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="Wikipédia (fr)"> <link rel="EditURI" type="application/rsd+xml" href="//fr.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://fr.wikipedia.org/wiki/Type_alg%C3%A9brique_de_donn%C3%A9es"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.fr"> <link rel="alternate" type="application/atom+xml" title="Flux Atom de Wikipédia" href="/w/index.php?title=Sp%C3%A9cial:Modifications_r%C3%A9centes&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-Type_algébrique_de_données rootpage-Type_algébrique_de_données skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Aller au contenu</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" > <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="Menu principal" > <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">Menu principal</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">Menu principal</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">déplacer vers la barre latérale</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">masquer</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/Wikip%C3%A9dia:Accueil_principal" title="Accueil général [z]" accesskey="z"><span>Accueil</span></a></li><li id="n-thema" class="mw-list-item"><a href="/wiki/Portail:Accueil"><span>Portails thématiques</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Sp%C3%A9cial:Page_au_hasard" title="Affiche un article au hasard [x]" accesskey="x"><span>Article au hasard</span></a></li><li id="n-contact" class="mw-list-item"><a href="/wiki/Wikip%C3%A9dia:Contact"><span>Contact</span></a></li> </ul> </div> </div> <div id="p-Contribuer" class="vector-menu mw-portlet mw-portlet-Contribuer" > <div class="vector-menu-heading"> Contribuer </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-aboutwp" class="mw-list-item"><a href="/wiki/Aide:D%C3%A9buter"><span>Débuter sur Wikipédia</span></a></li><li id="n-help" class="mw-list-item"><a href="/wiki/Aide:Accueil" title="Accès à l’aide"><span>Aide</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikip%C3%A9dia:Accueil_de_la_communaut%C3%A9" title="À propos du projet, ce que vous pouvez faire, où trouver les informations"><span>Communauté</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Sp%C3%A9cial:Modifications_r%C3%A9centes" title="Liste des modifications récentes sur le wiki [r]" accesskey="r"><span>Modifications récentes</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Wikip%C3%A9dia:Accueil_principal" 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="Wikipédia" src="/static/images/mobile/copyright/wikipedia-wordmark-fr.svg" style="width: 7.4375em; height: 1.125em;"> <img class="mw-logo-tagline" alt="l'encyclopédie libre" src="/static/images/mobile/copyright/wikipedia-tagline-fr.svg" width="120" height="13" style="width: 7.5em; 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/Sp%C3%A9cial:Recherche" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Rechercher sur Wikipédia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Rechercher</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="Rechercher sur Wikipédia" aria-label="Rechercher sur Wikipédia" autocapitalize="sentences" title="Rechercher sur Wikipédia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Spécial:Recherche"> </div> <button class="cdx-button cdx-search-input__end-button">Rechercher</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Outils personnels"> <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="Apparence"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Modifier l'apparence de la taille, de la largeur et de la couleur de la police de la page" > <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="Apparence" > <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">Apparence</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="//donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&utm_medium=sidebar&utm_campaign=C13_fr.wikipedia.org&uselang=fr" class=""><span>Faire un don</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=Sp%C3%A9cial:Cr%C3%A9er_un_compte&returnto=Type+alg%C3%A9brique+de+donn%C3%A9es" title="Nous vous encourageons à créer un compte utilisateur et vous connecter ; ce n’est cependant pas obligatoire." class=""><span>Créer un compte</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=Sp%C3%A9cial:Connexion&returnto=Type+alg%C3%A9brique+de+donn%C3%A9es" title="Nous vous encourageons à vous connecter ; ce n’est cependant pas obligatoire. [o]" accesskey="o" class=""><span>Se connecter</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="Plus d’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="Outils personnels" > <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">Outils personnels</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="Menu utilisateur" > <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="//donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&utm_medium=sidebar&utm_campaign=C13_fr.wikipedia.org&uselang=fr"><span>Faire un don</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Sp%C3%A9cial:Cr%C3%A9er_un_compte&returnto=Type+alg%C3%A9brique+de+donn%C3%A9es" title="Nous vous encourageons à créer un compte utilisateur et vous connecter ; ce n’est cependant pas obligatoire."><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Créer un compte</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Sp%C3%A9cial:Connexion&returnto=Type+alg%C3%A9brique+de+donn%C3%A9es" title="Nous vous encourageons à vous connecter ; ce n’est cependant pas obligatoire. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Se connecter</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 pour les contributeurs déconnectés <a href="/wiki/Aide:Premiers_pas" aria-label="En savoir plus sur la contribution"><span>en savoir plus</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/Sp%C3%A9cial:Mes_contributions" title="Une liste des modifications effectuées depuis cette adresse IP [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Sp%C3%A9cial:Mes_discussions" title="La page de discussion pour les contributions depuis cette adresse IP [n]" accesskey="n"><span>Discussion</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="Sommaire" 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">Sommaire</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">déplacer vers la barre latérale</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">masquer</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">Début</div> </a> </li> <li id="toc-Définitions" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Définitions"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Définitions</span> </div> </a> <button aria-controls="toc-Définitions-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>Afficher / masquer la sous-section Définitions</span> </button> <ul id="toc-Définitions-sublist" class="vector-toc-list"> <li id="toc-Type_produit" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Type_produit"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.1</span> <span>Type produit</span> </div> </a> <ul id="toc-Type_produit-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Type_somme" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Type_somme"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2</span> <span>Type somme</span> </div> </a> <ul id="toc-Type_somme-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Type_énuméré" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Type_énuméré"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.3</span> <span>Type énuméré</span> </div> </a> <ul id="toc-Type_énuméré-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Type_algébrique" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Type_algébrique"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.4</span> <span>Type algébrique</span> </div> </a> <ul id="toc-Type_algébrique-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Polymorphisme" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Polymorphisme"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Polymorphisme</span> </div> </a> <button aria-controls="toc-Polymorphisme-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>Afficher / masquer la sous-section Polymorphisme</span> </button> <ul id="toc-Polymorphisme-sublist" class="vector-toc-list"> <li id="toc-Type_algébrique_généralisé" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Type_algébrique_généralisé"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.1</span> <span>Type algébrique généralisé</span> </div> </a> <ul id="toc-Type_algébrique_généralisé-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Récursivité" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Récursivité"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Récursivité</span> </div> </a> <button aria-controls="toc-Récursivité-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>Afficher / masquer la sous-section Récursivité</span> </button> <ul id="toc-Récursivité-sublist" class="vector-toc-list"> <li id="toc-Listes" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Listes"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.1</span> <span>Listes</span> </div> </a> <ul id="toc-Listes-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Arbres" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Arbres"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.2</span> <span>Arbres</span> </div> </a> <ul id="toc-Arbres-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Abstraction" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Abstraction"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Abstraction</span> </div> </a> <ul id="toc-Abstraction-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Voir_aussi" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Voir_aussi"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>Voir aussi</span> </div> </a> <ul id="toc-Voir_aussi-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Notes_&_références" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Notes_&_références"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>Notes & références</span> </div> </a> <button aria-controls="toc-Notes_&_références-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>Afficher / masquer la sous-section Notes & références</span> </button> <ul id="toc-Notes_&_références-sublist" class="vector-toc-list"> <li id="toc-Notes" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Notes"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.1</span> <span>Notes</span> </div> </a> <ul id="toc-Notes-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Références" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Références"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.2</span> <span>Références</span> </div> </a> <ul id="toc-Références-sublist" class="vector-toc-list"> </ul> </li> </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="Sommaire" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <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="Basculer la table des matières" > <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">Basculer la table des matières</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">Type algébrique de données</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="Aller à un article dans une autre langue. Disponible en 11 langues." > <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-11" 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">11 langues</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-ca mw-list-item"><a href="https://ca.wikipedia.org/wiki/Tipus_de_dades_algebraic" title="Tipus de dades algebraic – catalan" lang="ca" hreflang="ca" data-title="Tipus de dades algebraic" data-language-autonym="Català" data-language-local-name="catalan" class="interlanguage-link-target"><span>Català</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Algebraischer_Datentyp" title="Algebraischer Datentyp – allemand" lang="de" hreflang="de" data-title="Algebraischer Datentyp" data-language-autonym="Deutsch" data-language-local-name="allemand" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-el mw-list-item"><a href="https://el.wikipedia.org/wiki/%CE%91%CE%BB%CE%B3%CE%B5%CE%B2%CF%81%CE%B9%CE%BA%CF%8C%CF%82_%CF%84%CF%8D%CF%80%CE%BF%CF%82_%CE%B4%CE%B5%CE%B4%CE%BF%CE%BC%CE%AD%CE%BD%CF%89%CE%BD" title="Αλγεβρικός τύπος δεδομένων – grec" lang="el" hreflang="el" data-title="Αλγεβρικός τύπος δεδομένων" data-language-autonym="Ελληνικά" data-language-local-name="grec" class="interlanguage-link-target"><span>Ελληνικά</span></a></li><li class="interlanguage-link interwiki-en mw-list-item"><a href="https://en.wikipedia.org/wiki/Algebraic_data_type" title="Algebraic data type – anglais" lang="en" hreflang="en" data-title="Algebraic data type" data-language-autonym="English" data-language-local-name="anglais" class="interlanguage-link-target"><span>English</span></a></li><li class="interlanguage-link interwiki-es mw-list-item"><a href="https://es.wikipedia.org/wiki/Tipo_de_dato_algebraico" title="Tipo de dato algebraico – espagnol" lang="es" hreflang="es" data-title="Tipo de dato algebraico" data-language-autonym="Español" data-language-local-name="espagnol" class="interlanguage-link-target"><span>Español</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/%E4%BB%A3%E6%95%B0%E7%9A%84%E3%83%87%E3%83%BC%E3%82%BF%E5%9E%8B" title="代数的データ型 – japonais" lang="ja" hreflang="ja" data-title="代数的データ型" data-language-autonym="日本語" data-language-local-name="japonais" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%EB%8C%80%EC%88%98%EC%A0%81_%EC%9E%90%EB%A3%8C%ED%98%95" title="대수적 자료형 – coréen" lang="ko" hreflang="ko" data-title="대수적 자료형" data-language-autonym="한국어" data-language-local-name="coréen" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-nl mw-list-item"><a href="https://nl.wikipedia.org/wiki/Algebra%C3%AFsch_datatype" title="Algebraïsch datatype – néerlandais" lang="nl" hreflang="nl" data-title="Algebraïsch datatype" data-language-autonym="Nederlands" data-language-local-name="néerlandais" class="interlanguage-link-target"><span>Nederlands</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/%D0%90%D0%BB%D0%B3%D0%B5%D0%B1%D1%80%D0%B0%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9_%D1%82%D0%B8%D0%BF_%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D1%85" title="Алгебраический тип данных – russe" lang="ru" hreflang="ru" data-title="Алгебраический тип данных" data-language-autonym="Русский" data-language-local-name="russe" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-uk mw-list-item"><a href="https://uk.wikipedia.org/wiki/%D0%90%D0%BB%D0%B3%D0%B5%D0%B1%D1%80%D0%B8%D1%87%D0%BD%D0%B8%D0%B9_%D1%82%D0%B8%D0%BF_%D0%B4%D0%B0%D0%BD%D0%B8%D1%85" title="Алгебричний тип даних – ukrainien" lang="uk" hreflang="uk" data-title="Алгебричний тип даних" data-language-autonym="Українська" data-language-local-name="ukrainien" class="interlanguage-link-target"><span>Українська</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/%E4%BB%A3%E6%95%B0%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B" title="代数数据类型 – chinois" lang="zh" hreflang="zh" data-title="代数数据类型" data-language-autonym="中文" data-language-local-name="chinois" 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/Q1322511#sitelinks-wikipedia" title="Modifier les liens interlangues" class="wbc-editpage">Modifier les liens</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="Espaces de noms"> <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/Type_alg%C3%A9brique_de_donn%C3%A9es" title="Voir le contenu de la page [c]" accesskey="c"><span>Article</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Discussion:Type_alg%C3%A9brique_de_donn%C3%A9es" rel="discussion" title="Discussion au sujet de cette page de contenu [t]" accesskey="t"><span>Discussion</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="Modifier la variante de langue" > <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">français</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="Affichages"> <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/Type_alg%C3%A9brique_de_donn%C3%A9es"><span>Lire</span></a></li><li id="ca-ve-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit" title="Modifier cette page [v]" accesskey="v"><span>Modifier</span></a></li><li id="ca-edit" class="collapsible vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit" title="Modifier le wikicode de cette page [e]" accesskey="e"><span>Modifier le code</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=history" title="Historique des versions de cette page [h]" accesskey="h"><span>Voir l’historique</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Outils de la page"> <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="Outils" > <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">Outils</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">Outils</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">déplacer vers la barre latérale</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">masquer</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="Plus d’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/Type_alg%C3%A9brique_de_donn%C3%A9es"><span>Lire</span></a></li><li id="ca-more-ve-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit" title="Modifier cette page [v]" accesskey="v"><span>Modifier</span></a></li><li id="ca-more-edit" class="collapsible vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit" title="Modifier le wikicode de cette page [e]" accesskey="e"><span>Modifier le code</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=history"><span>Voir l’historique</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> Général </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Sp%C3%A9cial:Pages_li%C3%A9es/Type_alg%C3%A9brique_de_donn%C3%A9es" title="Liste des pages liées qui pointent sur celle-ci [j]" accesskey="j"><span>Pages liées</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Sp%C3%A9cial:Suivi_des_liens/Type_alg%C3%A9brique_de_donn%C3%A9es" rel="nofollow" title="Liste des modifications récentes des pages appelées par celle-ci [k]" accesskey="k"><span>Suivi des pages liées</span></a></li><li id="t-upload" class="mw-list-item"><a href="/wiki/Aide:Importer_un_fichier" title="Téléverser des fichiers [u]" accesskey="u"><span>Téléverser un fichier</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Sp%C3%A9cial:Pages_sp%C3%A9ciales" title="Liste de toutes les pages spéciales [q]" accesskey="q"><span>Pages spéciales</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&oldid=217277222" title="Adresse permanente de cette version de cette page"><span>Lien permanent</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=info" title="Davantage d’informations sur cette page"><span>Informations sur la page</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Sp%C3%A9cial:Citer&page=Type_alg%C3%A9brique_de_donn%C3%A9es&id=217277222&wpFormIdentifier=titleform" title="Informations sur la manière de citer cette page"><span>Citer cette page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Sp%C3%A9cial:UrlShortener&url=https%3A%2F%2Ffr.wikipedia.org%2Fwiki%2FType_alg%25C3%25A9brique_de_donn%25C3%25A9es"><span>Obtenir l'URL raccourcie</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Sp%C3%A9cial:QrCode&url=https%3A%2F%2Ffr.wikipedia.org%2Fwiki%2FType_alg%25C3%25A9brique_de_donn%25C3%25A9es"><span>Télécharger le code QR</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"> Imprimer / exporter </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-create_a_book" class="mw-list-item"><a href="/w/index.php?title=Sp%C3%A9cial:Livre&bookcmd=book_creator&referer=Type+alg%C3%A9brique+de+donn%C3%A9es"><span>Créer un livre</span></a></li><li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Sp%C3%A9cial:DownloadAsPdf&page=Type_alg%C3%A9brique_de_donn%C3%A9es&action=show-download-screen"><span>Télécharger comme PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&printable=yes" title="Version imprimable de cette page [p]" accesskey="p"><span>Version imprimable</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"> Dans d’autres projets </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/Q1322511" title="Lien vers l’élément dans le dépôt de données connecté [g]" accesskey="g"><span>Élément Wikidata</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="Outils de la page"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Apparence"> <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">Apparence</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">déplacer vers la barre latérale</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">masquer</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">Un article de Wikipédia, l'encyclopédie libre.</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="fr" dir="ltr"><div class="bandeau-container metadata homonymie hatnote"><div class="bandeau-cell bandeau-icone" style="display:table-cell;padding-right:0.5em"><span class="noviewer" typeof="mw:File"><a href="/wiki/Aide:Homonymie" title="Aide:Homonymie"><img alt="Page d’aide sur l’homonymie" src="//upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Logo_disambig.svg/20px-Logo_disambig.svg.png" decoding="async" width="20" height="15" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Logo_disambig.svg/30px-Logo_disambig.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Logo_disambig.svg/40px-Logo_disambig.svg.png 2x" data-file-width="512" data-file-height="375" /></a></span></div><div class="bandeau-cell" style="display:table-cell;padding-right:0.5em"> <p>Pour les articles homonymes, voir <a href="/wiki/Alg%C3%A9brique" class="mw-disambig" title="Algébrique">Algébrique</a>. </p> </div></div> <div class="bandeau-container metadata bandeau-article bandeau-niveau-ebauche"><div class="bandeau-cell bandeau-icone" style="display:table-cell;padding-right:0.5em"><span class="noviewer" typeof="mw:File"><a href="/wiki/Fichier:Circle-icons-computer.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/0/02/Circle-icons-computer.svg/35px-Circle-icons-computer.svg.png" decoding="async" width="35" height="35" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/0/02/Circle-icons-computer.svg/53px-Circle-icons-computer.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/0/02/Circle-icons-computer.svg/70px-Circle-icons-computer.svg.png 2x" data-file-width="512" data-file-height="512" /></a></span></div><div class="bandeau-cell" style="display:table-cell;padding-right:0.5em"> <p><strong class="bandeau-titre">Cet article est une <a href="/wiki/Aide:%C3%89bauche" title="Aide:Ébauche">ébauche</a> concernant l’<a href="/wiki/Informatique" title="Informatique">informatique</a>.</strong> </p><p>Vous pouvez partager vos connaissances en l’améliorant (<b><a href="/wiki/Aide:Comment_modifier_une_page" title="Aide:Comment modifier une page">comment ?</a></b>) selon les recommandations des <a href="/wiki/Projet:Accueil" title="Projet:Accueil">projets correspondants</a>. </p> </div></div> <p>Un <b>type algébrique</b> est une forme de <a href="/wiki/Type_(informatique)" title="Type (informatique)">type de données</a> composite<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite_crochet">[</span>note 1<span class="cite_crochet">]</span></a></sup>, qui combine les fonctionnalités des <b>types produits</b> (<a href="/wiki/Uplet" title="Uplet"><span class="texhtml"><i>n</i></span>‐uplets</a> ou <a href="/wiki/Enregistrement_(structure_de_donn%C3%A9es)" title="Enregistrement (structure de données)">enregistrements</a>) et des <b>types sommes</b> (<a href="/wiki/Union_disjointe" class="mw-redirect" title="Union disjointe">union disjointe</a>). Combinée à la <a href="/wiki/Type_r%C3%A9cursif" title="Type récursif">récursivité</a>, elle permet d’exprimer les données structurées telles que les <a href="/wiki/Liste_(informatique)" title="Liste (informatique)">listes</a> et les <a href="/wiki/Arbre_enracin%C3%A9" title="Arbre enraciné">arbres</a>. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Définitions"><span id="D.C3.A9finitions"></span>Définitions</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=1" title="Modifier la section : Définitions" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=1" title="Modifier le code source de la section : Définitions"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-heading mw-heading3"><h3 id="Type_produit">Type produit</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=2" title="Modifier la section : Type produit" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=2" title="Modifier le code source de la section : Type produit"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Le <b>type produit</b> de deux types <span class="texhtml mvar" style="font-style:italic;">A</span> et <span class="texhtml mvar" style="font-style:italic;">B</span> est l’analogue en <a href="/wiki/Th%C3%A9orie_des_types" title="Théorie des types">théorie des types</a> du <a href="/wiki/Produit_cart%C3%A9sien" title="Produit cartésien">produit cartésien</a> <a href="/wiki/Th%C3%A9orie_des_ensembles" title="Théorie des ensembles">ensembliste</a> et est noté <span class="texhtml"><span class="texhtml mvar" style="font-style:italic;">A</span> × <span class="texhtml mvar" style="font-style:italic;">B</span></span>. C’est le type des couples dont la première composante est de type <span class="texhtml mvar" style="font-style:italic;">A</span> et la seconde de type <span class="texhtml mvar" style="font-style:italic;">B</span>. Deux <a href="/wiki/Fonction_(informatique)" class="mw-redirect" title="Fonction (informatique)">fonctions</a> canoniques lui sont associées, appelées <i>projections</i>, donnant la valeur de chaque composante. </p> <div style="margin:0.5em 2em;"><strong>Exemple : type produit en <a href="/wiki/OCaml" title="OCaml">OCaml</a> :</strong> <div style="padding-left:2em; border-left:1px dotted #999;"> <p>On peut définir en langage OCaml le type d’une entrée de <a href="/wiki/Tableau_associatif" title="Tableau associatif">dictionnaire</a> : </p> <div class="mw-highlight mw-highlight-lang-ocaml mw-content-ltr" dir="ltr"><pre><span></span><span class="k">type</span> <span class="n">dict_entry</span> <span class="o">=</span> <span class="kt">string</span> <span class="o">*</span> <span class="kt">int</span> <span class="k">let</span> <span class="n">entry</span> <span class="o">=</span> <span class="o">(</span><span class="s2">"clé"</span><span class="o">,</span> <span class="mi">37</span><span class="o">)</span> <span class="c">(* get_value : dict_entry -> int *)</span> <span class="k">let</span> <span class="n">get_value</span> <span class="o">(</span><span class="n">key</span><span class="o">,</span> <span class="n">value</span><span class="o">)</span> <span class="o">=</span> <span class="n">value</span> </pre></div> </div></div> <p>Le produit se généralise naturellement à un nombre quelconque d’opérandes, pour donner des types de <span class="texhtml mvar" style="font-style:italic;">n</span>‐uplets. Dans le cas particulier du <a href="/wiki/Produit_vide" title="Produit vide">produit vide</a>, le type des 0‐uplets est nommé <b><a href="/wiki/Type_unit%C3%A9" title="Type unité">type unité</a></b> et noté <span class="texhtml"><b>1</b></span> : c’est l’<a href="/wiki/%C3%89l%C3%A9ment_neutre" title="Élément neutre">élément neutre</a> du produit et il contient une unique valeur, souvent notée <span class="texhtml">()</span>. </p><p>Des considérations pratiques amènent souvent à nommer les composantes<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite_crochet">[</span>note 2<span class="cite_crochet">]</span></a></sup>. Dans ce contexte, le type est souvent appelé <i>structure</i> et ses valeurs des <i>enregistrements</i> ; les composantes sont appelées <i>membres</i>, et la projection selon le membre <code>m</code> s’écrit avec une notation suffixe <code>.m</code>. </p> <div style="margin:0.5em 2em;"><strong>Exemple : structure en OCaml :</strong> <div style="padding-left:2em; border-left:1px dotted #999;"> <p>Toujours en OCaml, l’exemple précédent s’adapte ainsi : </p> <div class="mw-highlight mw-highlight-lang-ocaml mw-content-ltr" dir="ltr"><pre><span></span><span class="k">type</span> <span class="n">dict_entry</span> <span class="o">=</span> <span class="o">{</span> <span class="n">key</span> <span class="o">:</span> <span class="kt">string</span> <span class="o">;</span> <span class="n">value</span> <span class="o">:</span> <span class="kt">int</span> <span class="o">;</span> <span class="o">}</span> <span class="k">let</span> <span class="n">entry</span> <span class="o">=</span> <span class="o">{</span> <span class="n">key</span> <span class="o">=</span> <span class="s2">"clé"</span> <span class="o">;</span> <span class="n">value</span> <span class="o">=</span> <span class="mi">37</span> <span class="o">}</span> <span class="c">(* get_value : dict_entry -> int *)</span> <span class="k">let</span> <span class="n">get_value</span> <span class="n">entry</span> <span class="o">=</span> <span class="n">entry</span><span class="o">.</span><span class="n">value</span> </pre></div> </div></div> <div style="margin:0.5em 2em;"><strong>Exemple : structure en <a href="/wiki/Langage_C" class="mw-redirect" title="Langage C">langage C</a> :</strong> <div style="padding-left:2em; border-left:1px dotted #999;"> <p>Cette fonctionnalité se traduit en langage C par <a href="/w/index.php?title=Struct_(langage_C)&action=edit&redlink=1" class="new" title="Struct (langage C) (page inexistante)">le mot‐clé <code>struct</code></a> <a href="https://en.wikipedia.org/wiki/struct_(C_programming_language)" class="extiw" title="en:struct (C programming language)"><span class="indicateur-langue" title="Article en anglais : « struct (C programming language) »">(en)</span></a> : </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">typedef</span><span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="kt">char</span><span class="o">*</span><span class="w"> </span><span class="n">key</span><span class="w"> </span><span class="p">;</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">value</span><span class="w"> </span><span class="p">;</span> <span class="p">}</span><span class="w"> </span><span class="n">dict_entry</span><span class="w"> </span><span class="p">;</span> <span class="n">dict_entry</span><span class="w"> </span><span class="n">entry</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">.</span><span class="n">key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">"clé"</span><span class="p">,</span><span class="w"> </span><span class="p">.</span><span class="n">value</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">37</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">;</span> <span class="kt">int</span><span class="w"> </span><span class="nf">get_value</span><span class="w"> </span><span class="p">(</span><span class="n">dict_entry</span><span class="w"> </span><span class="n">entry</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">entry</span><span class="p">.</span><span class="n">value</span><span class="w"> </span><span class="p">;</span> <span class="p">}</span> </pre></div> </div></div> <div class="bandeau-container bandeau-section metadata bandeau-niveau-information"><div class="bandeau-cell bandeau-icone-css loupe">Article détaillé : <a href="/wiki/Enregistrement_(structure_de_donn%C3%A9es)" title="Enregistrement (structure de données)">enregistrement (structure de données)</a>.</div></div> <div class="mw-heading mw-heading3"><h3 id="Type_somme">Type somme</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=3" title="Modifier la section : Type somme" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=3" title="Modifier le code source de la section : Type somme"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Le <b>type somme</b> de deux types <span class="texhtml mvar" style="font-style:italic;">A</span> et <span class="texhtml mvar" style="font-style:italic;">B</span> est l’analogue en théorie des types de l’<a href="/wiki/Union_disjointe" class="mw-redirect" title="Union disjointe">union disjointe</a> ensembliste et est noté <span class="texhtml"><span class="texhtml mvar" style="font-style:italic;">A</span> + <span class="texhtml mvar" style="font-style:italic;">B</span></span>. Il représente un type contenant toutes les valeurs de chacun des deux types <span class="texhtml mvar" style="font-style:italic;">A</span> et <span class="texhtml mvar" style="font-style:italic;">B</span>, de telle sorte qu’une valeur issue de <span class="texhtml mvar" style="font-style:italic;">A</span> ne puisse pas être confondue avec une valeur issue de <span class="texhtml mvar" style="font-style:italic;">B</span> (même si <span class="texhtml"><span class="texhtml mvar" style="font-style:italic;">A</span> = <span class="texhtml mvar" style="font-style:italic;">B</span></span>). </p><p>En théorie des ensembles, on représenterait la somme par l’ensemble <span class="texhtml">{1}×<span class="texhtml mvar" style="font-style:italic;">A</span> ∪ {2}×<span class="texhtml mvar" style="font-style:italic;">B</span></span> ; la première composante (1 ou 2) d’un tel objet est une étiquette qui indique si cet objet se trouve dans le bras de gauche (<span class="texhtml mvar" style="font-style:italic;">A</span>) ou dans le bras de droite (<span class="texhtml mvar" style="font-style:italic;">B</span>) de la somme. Les analogues en théorie des types des expressions <span class="texhtml">(1, <span class="texhtml mvar" style="font-style:italic;">a</span>)</span> et <span class="texhtml">(2, <span class="texhtml mvar" style="font-style:italic;">b</span>)</span> sont souvent notés <span class="texhtml">ι<sub>1</sub> <span class="texhtml mvar" style="font-style:italic;">a</span></span> et <span class="texhtml">ι<sub>2</sub> <span class="texhtml mvar" style="font-style:italic;">b</span></span> (<span class="texhtml">ι</span> est la lettre grecque <i>iota</i>). Ces notations <span class="texhtml">ι<sub>1</sub></span> et <span class="texhtml">ι<sub>2</sub></span> peuvent être vues comme des fonctions <a href="/wiki/Fonction_injective" class="mw-redirect" title="Fonction injective">injectives</a>, respectivement de <span class="texhtml mvar" style="font-style:italic;">A</span> dans <span class="texhtml"><span class="texhtml mvar" style="font-style:italic;">A</span> + <span class="texhtml mvar" style="font-style:italic;">B</span></span> et de <span class="texhtml mvar" style="font-style:italic;">B</span> dans <span class="texhtml"><span class="texhtml mvar" style="font-style:italic;">A</span> + <span class="texhtml mvar" style="font-style:italic;">B</span></span>, qui permettent de construire les valeurs de la somme, d’où leur nom de <i>constructeurs</i>. Dans <span class="texhtml">ι<sub>1</sub> <span class="texhtml mvar" style="font-style:italic;">a</span></span>, la valeur <span class="texhtml mvar" style="font-style:italic;">a</span> est appelée l’<i>argument</i> du constructeur <span class="texhtml">ι<sub>1</sub></span>. </p><p>Traiter des valeurs d’un type somme requiert un raisonnement par cas, nommé dans ce contexte <i><a href="/wiki/Filtrage_par_motif" title="Filtrage par motif">filtrage par motif</a></i>. Chaque bras — qu’on reconnaît par son constructeur et dont on peut récupérer la valeur puisque ce constructeur est injectif — fait l’objet d’un cas séparé. </p> <div style="margin:0.5em 2em;"><strong>Exemple : type somme en OCaml :</strong> <div style="padding-left:2em; border-left:1px dotted #999;"> <p>On peut définir on OCaml l’union disjointe des nombres entiers et des nombres flottants et définir par filtrage une fonction sur cette union : </p> <div class="mw-highlight mw-highlight-lang-ocaml mw-content-ltr" dir="ltr"><pre><span></span><span class="k">type</span> <span class="n">sum</span> <span class="o">=</span> <span class="nc">Int</span> <span class="k">of</span> <span class="kt">int</span> <span class="o">|</span> <span class="nc">Float</span> <span class="k">of</span> <span class="kt">float</span> <span class="c">(* print : sum -> unit *)</span> <span class="k">let</span> <span class="n">print</span> <span class="o">=</span> <span class="k">function</span> <span class="o">|</span> <span class="nc">Int</span> <span class="n">i</span> <span class="o">-></span> <span class="nn">Printf</span><span class="p">.</span><span class="n">printf</span> <span class="s2">"%i"</span> <span class="n">i</span> <span class="o">|</span> <span class="nc">Float</span> <span class="n">f</span> <span class="o">-></span> <span class="nn">Printf</span><span class="p">.</span><span class="n">printf</span> <span class="s2">"%f"</span> <span class="n">f</span> </pre></div> <p>Ici, les constructeurs sont nommés <code>Int</code> et <code>Float</code>. </p> </div></div> <div style="margin:0.5em 2em;"><strong>Exemple : type « union » en langage C :</strong> <div style="padding-left:2em; border-left:1px dotted #999;"> <p>Cette fonctionnalité s’approxime en langage C avec <a href="/w/index.php?title=Union_(langage_C)&action=edit&redlink=1" class="new" title="Union (langage C) (page inexistante)">le mot clé <code>union</code></a> <a href="https://en.wikipedia.org/wiki/Union_type#C/C++" class="extiw" title="en:Union type"><span class="indicateur-langue" title="Article en anglais : « Union type#C/C++ »">(en)</span></a> à condition d’y adjoindre une étiquette, mais cela n’offre pas les mêmes garanties (on peut lire et modifier un objet du type somme en faisant fi de son étiquette — quitte à provoquer des <a href="/wiki/Bug_informatique" class="mw-redirect" title="Bug informatique">bugs</a>) : </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">typedef</span><span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">enum</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">INT</span><span class="p">,</span><span class="w"> </span><span class="n">FLOAT</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="n">tag</span><span class="w"> </span><span class="p">;</span> <span class="w"> </span><span class="k">union</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="p">;</span> <span class="w"> </span><span class="kt">float</span><span class="w"> </span><span class="n">f</span><span class="w"> </span><span class="p">;</span> <span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">;</span> <span class="p">}</span><span class="w"> </span><span class="n">sum_t</span><span class="w"> </span><span class="p">;</span> <span class="kt">void</span><span class="w"> </span><span class="nf">print</span><span class="w"> </span><span class="p">(</span><span class="n">sum_t</span><span class="w"> </span><span class="n">x</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">tag</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">INT</span><span class="p">)</span> <span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">"%i"</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">.</span><span class="n">i</span><span class="p">)</span><span class="w"> </span><span class="p">;</span> <span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">tag</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">FLOAT</span><span class="p">)</span> <span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">"%f"</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">.</span><span class="n">f</span><span class="p">)</span><span class="w"> </span><span class="p">;</span> <span class="p">}</span> </pre></div> </div></div> <p>La somme se généralise naturellement à un nombre quelconque d’opérandes. Dans le cas particulier de la <a href="/wiki/Somme_vide" title="Somme vide">somme vide</a>, le type est nommé <b><a href="/wiki/Type_vide" title="Type vide">type vide</a></b> et noté <span class="texhtml"><b>0</b></span> : c’est l’élément neutre de la somme (et <a href="/wiki/%C3%89l%C3%A9ment_absorbant" title="Élément absorbant">élément absorbant</a> du produit) et il ne contient aucune valeur. </p> <div class="mw-heading mw-heading3"><h3 id="Type_énuméré"><span id="Type_.C3.A9num.C3.A9r.C3.A9"></span>Type énuméré</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=4" title="Modifier la section : Type énuméré" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=4" title="Modifier le code source de la section : Type énuméré"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Un <b>type énuméré</b> représente un <a href="/wiki/Ensemble_fini" title="Ensemble fini">ensemble fini</a>, dont les éléments sont les différents constructeurs. Définir une fonction dessus revient à définir l’image de chaque élément, individuellement. </p> <div style="margin:0.5em 2em;"><strong>Exemple : type énuméré en OCaml :</strong> <div style="padding-left:2em; border-left:1px dotted #999;"> <p>On peut par exemple coder l’ensemble des quatre <a href="/wiki/Enseigne_(carte_%C3%A0_jouer)" title="Enseigne (carte à jouer)">couleurs d’un jeu de cartes classique</a> : </p> <div class="mw-highlight mw-highlight-lang-ocaml mw-content-ltr" dir="ltr"><pre><span></span><span class="k">type</span> <span class="n">couleur</span> <span class="o">=</span> <span class="nc">Coeur</span> <span class="o">|</span> <span class="nc">Carreau</span> <span class="o">|</span> <span class="nc">Trefle</span> <span class="o">|</span> <span class="nc">Pique</span> <span class="c">(* nom_de_la_couleur : couleur -> string *)</span> <span class="k">let</span> <span class="n">nom_de_la_couleur</span> <span class="o">=</span> <span class="k">function</span> <span class="o">|</span> <span class="nc">Coeur</span> <span class="o">-></span> <span class="s2">"♥ cœur"</span> <span class="o">|</span> <span class="nc">Carreau</span> <span class="o">-></span> <span class="s2">"♦ carreau"</span> <span class="o">|</span> <span class="nc">Trefle</span> <span class="o">-></span> <span class="s2">"♣ trèfle"</span> <span class="o">|</span> <span class="nc">Pique</span> <span class="o">-></span> <span class="s2">"♠ pique"</span> </pre></div> </div></div> <div style="margin:0.5em 2em;"><strong>Exemple : type énuméré en langage C :</strong> <div style="padding-left:2em; border-left:1px dotted #999;"> <p>Cette fonctionnalité se traduit en langage C par le mot‐clé <code>enum</code> : </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">typedef</span><span class="w"> </span><span class="k">enum</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">COEUR</span><span class="p">,</span><span class="w"> </span><span class="n">CARREAU</span><span class="p">,</span><span class="w"> </span><span class="n">TREFLE</span><span class="p">,</span><span class="w"> </span><span class="n">PIQUE</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="n">couleur</span><span class="w"> </span><span class="p">;</span> <span class="kt">char</span><span class="o">*</span><span class="w"> </span><span class="nf">nom_de_la_couleur</span><span class="w"> </span><span class="p">(</span><span class="n">couleur</span><span class="w"> </span><span class="n">c</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">switch</span><span class="w"> </span><span class="p">(</span><span class="n">c</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">case</span><span class="w"> </span><span class="no">COEUR</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="s">"♥ cœur"</span><span class="w"> </span><span class="p">;</span> <span class="w"> </span><span class="k">case</span><span class="w"> </span><span class="no">CARREAU</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="s">"♦ carreau"</span><span class="w"> </span><span class="p">;</span> <span class="w"> </span><span class="k">case</span><span class="w"> </span><span class="no">TREFLE</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="s">"♣ trèfle"</span><span class="w"> </span><span class="p">;</span> <span class="w"> </span><span class="k">case</span><span class="w"> </span><span class="no">PIQUE</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="s">"♠ pique"</span><span class="w"> </span><span class="p">;</span> <span class="w"> </span><span class="p">}</span> <span class="p">}</span> </pre></div> </div></div> <div class="bandeau-container bandeau-section metadata bandeau-niveau-information"><div class="bandeau-cell bandeau-icone-css loupe">Article détaillé : <a href="/wiki/Type_%C3%A9num%C3%A9r%C3%A9" title="Type énuméré">type énuméré</a>.</div></div> <div class="mw-heading mw-heading3"><h3 id="Type_algébrique"><span id="Type_alg.C3.A9brique"></span>Type algébrique</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=5" title="Modifier la section : Type algébrique" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=5" title="Modifier le code source de la section : Type algébrique"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Un <b>type algébrique</b> est une somme de produits, et généralise donc ces deux notions. </p><p>Ainsi, des cas spéciaux de types algébriques sont les types produits (un seul constructeur), les types sommes (un seul argument pour chaque constructeur) et les types énumérations (plusieurs constructeurs sans argument). </p> <div style="margin:0.5em 2em;"><strong>Exemple : type option et type résultat :</strong> <div style="padding-left:2em; border-left:1px dotted #999;"> <p>Les <a href="/w/index.php?title=Type_option&action=edit&redlink=1" class="new" title="Type option (page inexistante)">types options</a> <a href="https://en.wikipedia.org/wiki/option_type" class="extiw" title="en:option type"><span class="indicateur-langue" title="Article en anglais : « option type »">(en)</span></a> sont des applications courantes de types algébriques. Ils permettent d’ajouter à un type donné une valeur spéciale, considérée comme « indéfinie » ou comme valeur d’erreur (l’équivalent de <code>null</code> dans certains langages de programmation), ce qui permet de définir des fonctions partielles de façon contrôlée. </p><p>La valeur spéciale est représentée par un constructeur <code>None</code> qui ne prend aucun argument, tandis que les valeurs du type à compléter sont enveloppées dans un constructeur <code>Some</code> (qui prend donc un argument de ce type). </p> <div class="mw-highlight mw-highlight-lang-ocaml mw-content-ltr" dir="ltr"><pre><span></span><span class="k">type</span> <span class="n">int_option</span> <span class="o">=</span> <span class="nc">None</span> <span class="o">|</span> <span class="nc">Some</span> <span class="k">of</span> <span class="kt">int</span> <span class="c">(* division : int -> int -> int_option *)</span> <span class="k">let</span> <span class="n">division</span> <span class="n">x</span> <span class="n">y</span> <span class="o">=</span> <span class="k">if</span> <span class="n">y</span> <span class="o">=</span> <span class="mi">0</span> <span class="k">then</span> <span class="nc">None</span> <span class="k">else</span> <span class="nc">Some</span> <span class="o">(</span><span class="n">x</span> <span class="o">/</span> <span class="n">y</span><span class="o">)</span> </pre></div> <p>On peut perfectionner le mécanisme en agrémentant le cas d’erreur d’un message de description (donnée de type <code>string</code>). </p> <div class="mw-highlight mw-highlight-lang-ocaml mw-content-ltr" dir="ltr"><pre><span></span><span class="k">type</span> <span class="n">int_result</span> <span class="o">=</span> <span class="nc">Result</span> <span class="k">of</span> <span class="kt">int</span> <span class="o">|</span> <span class="nc">Error</span> <span class="k">of</span> <span class="kt">string</span> <span class="c">(* division : int -> int -> int_result *)</span> <span class="k">let</span> <span class="n">division</span> <span class="n">x</span> <span class="n">y</span> <span class="o">=</span> <span class="k">if</span> <span class="n">y</span> <span class="o">=</span> <span class="mi">0</span> <span class="k">then</span> <span class="nc">Error</span> <span class="s2">"division by zero"</span> <span class="k">else</span> <span class="nc">Result</span> <span class="o">(</span><span class="n">x</span> <span class="o">/</span> <span class="n">y</span><span class="o">)</span> </pre></div> </div></div> <div class="mw-heading mw-heading2"><h2 id="Polymorphisme">Polymorphisme</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=6" title="Modifier la section : Polymorphisme" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=6" title="Modifier le code source de la section : Polymorphisme"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="bandeau-container bandeau-section metadata bandeau-niveau-information"><div class="bandeau-cell bandeau-icone"><span class="mw-valign-text-top noviewer" typeof="mw:File"><a href="/wiki/Fichier:Fairytale_warning.png" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/8/87/Fairytale_warning.png/17px-Fairytale_warning.png" decoding="async" width="17" height="17" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/8/87/Fairytale_warning.png/26px-Fairytale_warning.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/8/87/Fairytale_warning.png/34px-Fairytale_warning.png 2x" data-file-width="64" data-file-height="64" /></a></span></div><div class="bandeau-cell">Cette section est vide, insuffisamment détaillée ou incomplète. <a href="/wiki/Sp%C3%A9cial:EditPage/Type_alg%C3%A9brique_de_donn%C3%A9es" title="Spécial:EditPage/Type algébrique de données">Votre aide</a> est la bienvenue ! <a href="/wiki/Aide:Comment_modifier_une_page" title="Aide:Comment modifier une page">Comment faire ?</a></div></div> <p>Dans les <a href="/wiki/Langage_de_programmation" title="Langage de programmation">langages</a> qui les supportent, les types algébriques peuvent être <a href="/wiki/Polymorphisme_(informatique)" title="Polymorphisme (informatique)">(paramétriquement) polymorphes</a>, ce qui permet la <a href="/wiki/Programmation_g%C3%A9n%C3%A9rique" class="mw-redirect" title="Programmation générique">programmation générique</a>. Ainsi, la définition d’un type algébrique peut être paramétrée par des variables de types. </p><p>On peut alors définir des fonctions génériques agissant sur de tels types polymorphes. </p> <div style="margin:0.5em 2em;"><strong>Exemple : type option polymorphe :</strong> <div style="padding-left:2em; border-left:1px dotted #999;"> <p>On peut rendre polymorphe la définition du type option vue précédemment. Ça s’écrit ainsi en langage OCaml (où <code>'a</code> dénote une variable de type) : </p> <div class="mw-highlight mw-highlight-lang-ocaml mw-content-ltr" dir="ltr"><pre><span></span><span class="k">type</span> <span class="k">'</span><span class="n">a</span> <span class="n">option</span> <span class="o">=</span> <span class="nc">None</span> <span class="o">|</span> <span class="nc">Some</span> <span class="k">of</span> <span class="k">'</span><span class="n">a</span> <span class="c">(** Utilisation d’instances du type polymorphe : **)</span> <span class="c">(* int_division : int -> int -> int option *)</span> <span class="k">let</span> <span class="n">int_division</span> <span class="n">x</span> <span class="n">y</span> <span class="o">=</span> <span class="k">if</span> <span class="n">y</span> <span class="o">=</span> <span class="mi">0</span> <span class="k">then</span> <span class="nc">None</span> <span class="k">else</span> <span class="nc">Some</span> <span class="o">(</span><span class="n">x</span> <span class="o">/</span> <span class="n">y</span><span class="o">)</span> <span class="c">(* float_division : float -> float -> float option *)</span> <span class="k">let</span> <span class="n">float_division</span> <span class="n">x</span> <span class="n">y</span> <span class="o">=</span> <span class="k">if</span> <span class="n">y</span> <span class="o">=</span> <span class="mi">0</span><span class="o">.</span><span class="mi">0</span> <span class="k">then</span> <span class="nc">None</span> <span class="k">else</span> <span class="nc">Some</span> <span class="o">(</span><span class="n">x</span> <span class="o">/.</span> <span class="n">y</span><span class="o">)</span> <span class="c">(** Définition d’une fonction générique : **)</span> <span class="c">(* get_value : 'a -> 'a option -> 'a *)</span> <span class="k">let</span> <span class="n">get_value</span> <span class="n">default_value</span> <span class="n">optional_value</span> <span class="o">=</span> <span class="k">match</span> <span class="n">optional_value</span> <span class="k">with</span> <span class="o">|</span> <span class="nc">None</span> <span class="o">-></span> <span class="n">default_value</span> <span class="o">|</span> <span class="nc">Some</span> <span class="n">value</span> <span class="o">-></span> <span class="n">value</span> </pre></div> </div></div> <div class="mw-heading mw-heading3"><h3 id="Type_algébrique_généralisé"><span id="Type_alg.C3.A9brique_g.C3.A9n.C3.A9ralis.C3.A9"></span>Type algébrique généralisé <span id="GADT"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=7" title="Modifier la section : Type algébrique généralisé" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=7" title="Modifier le code source de la section : Type algébrique généralisé"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="bandeau-container bandeau-section metadata bandeau-niveau-information"><div class="bandeau-cell bandeau-icone"><span class="mw-valign-text-top noviewer" typeof="mw:File"><a href="/wiki/Fichier:Fairytale_warning.png" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/8/87/Fairytale_warning.png/17px-Fairytale_warning.png" decoding="async" width="17" height="17" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/8/87/Fairytale_warning.png/26px-Fairytale_warning.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/8/87/Fairytale_warning.png/34px-Fairytale_warning.png 2x" data-file-width="64" data-file-height="64" /></a></span></div><div class="bandeau-cell">Cette section est vide, insuffisamment détaillée ou incomplète. <a href="/wiki/Sp%C3%A9cial:EditPage/Type_alg%C3%A9brique_de_donn%C3%A9es" title="Spécial:EditPage/Type algébrique de données">Votre aide</a> est la bienvenue ! <a href="/wiki/Aide:Comment_modifier_une_page" title="Aide:Comment modifier une page">Comment faire ?</a></div></div> <div class="mw-heading mw-heading2"><h2 id="Récursivité"><span id="R.C3.A9cursivit.C3.A9"></span>Récursivité</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=8" title="Modifier la section : Récursivité" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=8" title="Modifier le code source de la section : Récursivité"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="bandeau-container bandeau-section metadata bandeau-niveau-information"><div class="bandeau-cell bandeau-icone-css loupe">Article détaillé : <a href="/wiki/Type_r%C3%A9cursif" title="Type récursif">type récursif</a>.</div></div> <div class="bandeau-container bandeau-section metadata bandeau-niveau-information"><div class="bandeau-cell bandeau-icone"><span class="mw-valign-text-top noviewer" typeof="mw:File"><a href="/wiki/Fichier:Fairytale_warning.png" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/8/87/Fairytale_warning.png/17px-Fairytale_warning.png" decoding="async" width="17" height="17" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/8/87/Fairytale_warning.png/26px-Fairytale_warning.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/8/87/Fairytale_warning.png/34px-Fairytale_warning.png 2x" data-file-width="64" data-file-height="64" /></a></span></div><div class="bandeau-cell">Cette section est vide, insuffisamment détaillée ou incomplète. <a href="/wiki/Sp%C3%A9cial:EditPage/Type_alg%C3%A9brique_de_donn%C3%A9es" title="Spécial:EditPage/Type algébrique de données">Votre aide</a> est la bienvenue ! <a href="/wiki/Aide:Comment_modifier_une_page" title="Aide:Comment modifier une page">Comment faire ?</a></div></div> <div class="mw-heading mw-heading3"><h3 id="Listes">Listes</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=9" title="Modifier la section : Listes" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=9" title="Modifier le code source de la section : Listes"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Un des exemples les plus importants de type algébrique est le type <a href="/wiki/Liste_(informatique)" title="Liste (informatique)">liste</a>, défini de façon récursive par deux constructeurs : </p> <ul><li><span class="texhtml">Nil</span>, aussi noté <code>[]</code>, qui désigne la liste vide,</li> <li>et <span class="texhtml">Cons</span> (abréviation de « constructeur »), aussi noté <code>::</code> ou <code>:</code>, qui désigne la combinaison d’un élément et d’une liste plus courte.</li></ul> <p>Par exemple, <span class="texhtml">Cons 1 (Cons 2 (Cons 3 (Cons 4 Nil)))</span>, aussi noté <code>1 :: 2 :: 3 :: 4 :: []</code>, est la liste constituée des quatre éléments 1, 2, 3, 4, dans cet ordre. </p><p>Toutes les opérations sur les listes se définissent alors par récurrence, en utilisant le filtrage par motif. Par exemple, pour calculer la longueur d’une liste : </p> <ul><li>la longueur de la liste vide (<span class="texhtml">Nil</span>) est zéro,</li> <li>et la longueur d’une liste de la forme <span class="texhtml">Cons <span class="texhtml mvar" style="font-style:italic;">x</span> <span class="texhtml mvar" style="font-style:italic;">suite</span></span> est un plus la longueur de la liste <span class="texhtml mvar" style="font-style:italic;">suite</span>.</li></ul> <div style="margin:0.5em 2em;"><strong>Exemple : type liste en OCaml :</strong> <div style="padding-left:2em; border-left:1px dotted #999;"> <p>Cette définition se traduit ainsi en langage OCaml : </p> <div class="mw-highlight mw-highlight-lang-ocaml mw-content-ltr" dir="ltr"><pre><span></span><span class="k">type</span> <span class="k">'</span><span class="n">a</span> <span class="kt">list</span> <span class="o">=</span> <span class="o">|</span> <span class="nc">Nil</span> <span class="o">|</span> <span class="nc">Cons</span> <span class="k">of</span> <span class="k">'</span><span class="n">a</span> <span class="o">*</span> <span class="k">'</span><span class="n">a</span> <span class="kt">list</span> <span class="k">let</span> <span class="n">list1234</span> <span class="o">=</span> <span class="nc">Cons</span> <span class="mi">1</span> <span class="o">(</span><span class="nc">Cons</span> <span class="mi">2</span> <span class="o">(</span><span class="nc">Cons</span> <span class="mi">3</span> <span class="o">(</span><span class="nc">Cons</span> <span class="mi">4</span> <span class="nc">Nil</span><span class="o">)))</span> <span class="k">let</span> <span class="k">rec</span> <span class="n">length</span> <span class="o">=</span> <span class="k">function</span> <span class="o">|</span> <span class="nc">Nil</span> <span class="o">-></span> <span class="mi">0</span> <span class="o">|</span> <span class="nc">Cons</span> <span class="n">x</span> <span class="n">s</span> <span class="o">-></span> <span class="mi">1</span> <span class="o">+</span> <span class="n">length</span> <span class="n">s</span> </pre></div> </div></div> <div class="mw-heading mw-heading3"><h3 id="Arbres">Arbres</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=10" title="Modifier la section : Arbres" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=10" title="Modifier le code source de la section : Arbres"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Les types algébriques permettent également de définir des structures d’<a href="/wiki/Arbre_(informatique)" class="mw-redirect" title="Arbre (informatique)">arbres</a>. Un <a href="/wiki/Arbre_binaire" title="Arbre binaire">arbre binaire</a> peut se construire au moyen de deux constructeurs : </p> <ul><li><span class="texhtml">Leaf <span class="texhtml mvar" style="font-style:italic;">e</span></span> qui désigne une feuille d’étiquette <span class="texhtml mvar" style="font-style:italic;">e</span>,</li> <li>et <span class="texhtml">Node <span class="texhtml mvar" style="font-style:italic;">e</span> <span class="texhtml mvar" style="font-style:italic;">g</span> <span class="texhtml mvar" style="font-style:italic;">d</span></span> qui désigne un nœud interne d’étiquette <span class="texhtml mvar" style="font-style:italic;">e</span>, de fils gauche <span class="texhtml mvar" style="font-style:italic;">g</span> et de fils droit <span class="texhtml mvar" style="font-style:italic;">d</span>.</li></ul> <p>Par exemple, </p> <pre>Node 1 (Node 2 (Leaf 4) (Node 5 (Leaf 6) (Leaf 7) ) ) (Leaf 3) </pre> <p>est l’arbre suivant : </p> <pre> 1 / \ 2 3 / \ 4 5 / \ 6 7 </pre> <p>Comme pour les listes, les opérations sur les arbres se définissent par récurrence. Par exemple, pour calculer la hauteur d’un arbre : </p> <ul><li>la hauteur d’une feuille est un,</li> <li>et la hauteur d’un nœud interne est un plus le maximum de la hauteur de ses deux fils.</li></ul> <div style="margin:0.5em 2em;"><strong>Exemple : type arbre binaire en OCaml :</strong> <div style="padding-left:2em; border-left:1px dotted #999;"> <p>Cette définition se traduit ainsi en langage OCaml : </p> <div class="mw-highlight mw-highlight-lang-ocaml mw-content-ltr" dir="ltr"><pre><span></span><span class="k">type</span> <span class="n">tree</span> <span class="o">=</span> <span class="o">|</span> <span class="nc">Leaf</span> <span class="k">of</span> <span class="kt">int</span> <span class="o">|</span> <span class="nc">Node</span> <span class="k">of</span> <span class="n">tree</span> <span class="o">*</span> <span class="kt">int</span> <span class="o">*</span> <span class="n">tree</span> <span class="k">let</span> <span class="n">my_tree</span> <span class="o">=</span> <span class="nc">Node</span> <span class="mi">1</span> <span class="o">(</span><span class="nc">Node</span> <span class="mi">2</span> <span class="o">(</span><span class="nc">Leaf</span> <span class="mi">4</span><span class="o">)</span> <span class="o">(</span><span class="nc">Node</span> <span class="mi">5</span> <span class="o">(</span><span class="nc">Leaf</span> <span class="mi">6</span><span class="o">)</span> <span class="o">(</span><span class="nc">Leaf</span> <span class="mi">7</span><span class="o">)))</span> <span class="o">(</span><span class="nc">Leaf</span> <span class="mi">3</span><span class="o">)</span> <span class="k">let</span> <span class="k">rec</span> <span class="n">height</span> <span class="o">=</span> <span class="k">function</span> <span class="o">|</span> <span class="nc">Leaf</span> <span class="n">e</span> <span class="o">-></span> <span class="mi">1</span> <span class="o">|</span> <span class="nc">Node</span> <span class="n">e</span> <span class="n">l</span> <span class="n">r</span> <span class="o">-></span> <span class="mi">1</span> <span class="o">+</span> <span class="n">max</span> <span class="o">(</span><span class="n">height</span> <span class="n">l</span><span class="o">)</span> <span class="o">(</span><span class="n">height</span> <span class="n">r</span><span class="o">)</span> </pre></div> </div></div> <div class="mw-heading mw-heading2"><h2 id="Abstraction">Abstraction</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=11" title="Modifier la section : Abstraction" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=11" title="Modifier le code source de la section : Abstraction"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Un type algébrique peut être <a href="/wiki/Type_abstrait" title="Type abstrait">abstrait</a> : il suffit pour ça de ne pas exposer sa structure interne (ses constructeurs et leurs divers champs). Ainsi, il ne peut être manipulé que par les fonctions prévues à cet effet, et son implémentation peut être changée. </p><p>C’est une technique fréquente car les types algébriques permettent de réaliser des structures de données complexes. </p> <div class="mw-heading mw-heading2"><h2 id="Voir_aussi">Voir aussi</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=12" title="Modifier la section : Voir aussi" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=12" title="Modifier le code source de la section : Voir aussi"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="/wiki/Type_(informatique)" title="Type (informatique)">Type</a></li> <li><a href="/wiki/Type_r%C3%A9cursif" title="Type récursif">Type récursif</a></li> <li><a href="/wiki/Filtrage_par_motif" title="Filtrage par motif">Filtrage par motif</a></li> <li><a href="/wiki/Enregistrement_(structure_de_donn%C3%A9es)" title="Enregistrement (structure de données)">Enregistrement</a></li> <li><a href="/wiki/Type_%C3%A9num%C3%A9r%C3%A9" title="Type énuméré">Énumération</a></li> <li><a href="/w/index.php?title=Type_option&action=edit&redlink=1" class="new" title="Type option (page inexistante)">Type option</a> <a href="https://en.wikipedia.org/wiki/Option_type" class="extiw" title="en:Option type"><span class="indicateur-langue" title="Article en anglais : « Option type »">(en)</span></a></li> <li><a href="/wiki/Liste_(informatique)" title="Liste (informatique)">Liste</a></li> <li><a href="/wiki/Arbre_(informatique)" class="mw-redirect" title="Arbre (informatique)">Arbre</a></li></ul> <div class="mw-heading mw-heading2"><h2 id="Notes_&_références"><span id="Notes_.26_r.C3.A9f.C3.A9rences"></span>Notes & références</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=13" title="Modifier la section : Notes & références" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=13" title="Modifier le code source de la section : Notes & références"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-heading mw-heading3"><h3 id="Notes">Notes</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=14" title="Modifier la section : Notes" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=14" title="Modifier le code source de la section : Notes"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="references-small decimal" style=""><div class="mw-references-wrap"><ol class="references"> <li id="cite_note-1"><span class="mw-cite-backlink noprint"><a href="#cite_ref-1">↑</a> </span><span class="reference-text">C’est‐à‐dire un type formé en combinant d’autres types plus simples.</span> </li> <li id="cite_note-2"><span class="mw-cite-backlink noprint"><a href="#cite_ref-2">↑</a> </span><span class="reference-text">De <i><a href="/wiki/Typage_structurel" class="mw-redirect" title="Typage structurel">structurel</a></i>, le typage devient alors <i><a href="/wiki/Typage_nominatif" class="mw-redirect" title="Typage nominatif">nominal</a></i>. Dans le premier cas, l’expression d’un <span class="texhtml mvar" style="font-style:italic;">n</span>‐uplet permet de déduire entièrement sa structure (par exemple, <code>("clé", 37)</code> est de type <code>string * int</code>) et déclarer le type est donc superflu. Dans le second cas, au contraire, l’expression ne suffit pas (<code>{ key = "clé" ; value = 37 }</code> peut suivre la structure <code>{ key : string ; value : int }</code> mais aussi <code>{ value : int ; key : string }</code> — qui est différente —, et l’expression <code>entry.value</code> permet seulement de déduire que la structure de <code>entry</code> contient un champ nommé <code>value</code>), et il faut donc déclarer les structures utilisées afin d’associer chaque nom de membre à une structure.</span> </li> </ol></div> </div> <div class="mw-heading mw-heading3"><h3 id="Références"><span id="R.C3.A9f.C3.A9rences"></span>Références</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&veaction=edit&section=15" title="Modifier la section : Références" class="mw-editsection-visualeditor"><span>modifier</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&action=edit&section=15" title="Modifier le code source de la section : Références"><span>modifier le code</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="references-small decimal" style=""> </div> <ul><li><abbr class="abbr indicateur-langue" title="Langue : anglais">(en)</abbr> <a rel="nofollow" class="external text" href="http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?algebraic+data+type"><i><span class="lang-en" lang="en">Algebraic data type</span></i></a> dans <i><span class="lang-en" lang="en">The Free On-line Dictionary of Computing</span></i>, rédacteur en chef Denis Howe.</li></ul> <div class="navbox-container" style="clear:both;"> <table class="navbox collapsible noprint autocollapse" style=""> <tbody><tr><th class="navbox-title" colspan="2" style=""><div style="float:left; width:6em; text-align:left"><div class="noprint plainlinks nowrap tnavbar" style="padding:0; font-size:xx-small; color:var(--color-emphasized, #000000);"><a href="/wiki/Mod%C3%A8le:Palette_Types_de_donn%C3%A9es" title="Modèle:Palette Types de données"><abbr class="abbr" title="Voir ce modèle.">v</abbr></a> · <a class="external text" href="https://fr.wikipedia.org/w/index.php?title=Mod%C3%A8le:Palette_Types_de_donn%C3%A9es&action=edit"><abbr class="abbr" title="Modifier ce modèle. Merci de prévisualiser avant de sauvegarder.">m</abbr></a></div></div><div style="font-size:110%"><a href="/wiki/Type_(informatique)" title="Type (informatique)">Types de données</a></div></th> </tr> <tr> <th class="navbox-group" style="">Non interprétée</th> <td class="navbox-list" style=""><div class="liste-horizontale"> <ul><li><a href="/wiki/Bit" title="Bit">Bit</a></li> <li><a href="/wiki/Byte" title="Byte">Byte</a></li> <li><a href="/wiki/Syst%C3%A8me_ternaire" title="Système ternaire">Trit</a></li> <li><a href="/wiki/Syst%C3%A8me_ternaire#Représentation_ternaire_compacte" title="Système ternaire">Tryte</a></li> <li><a href="/wiki/Mot_(architecture_informatique)" title="Mot (architecture informatique)">Mot</a></li></ul> </div></td> </tr> <tr> <th class="navbox-group" style="">Numérique</th> <td class="navbox-list navbox-even" style=""><div class="liste-horizontale"> <ul><li><a href="/wiki/Arithm%C3%A9tique_multipr%C3%A9cision" title="Arithmétique multiprécision">Bignum</a></li> <li><a href="/w/index.php?title=Complex_data_type&action=edit&redlink=1" class="new" title="Complex data type (page inexistante)">Complexe</a> <a href="https://en.wikipedia.org/wiki/complex_data_type" class="extiw" title="en:complex data type"><span class="indicateur-langue" title="Article en anglais : « complex data type »">(en)</span></a></li> <li><a href="/w/index.php?title=Decimal_data_type&action=edit&redlink=1" class="new" title="Decimal data type (page inexistante)">Décimal</a> <a href="https://en.wikipedia.org/wiki/Decimal_data_type" class="extiw" title="en:Decimal data type"><span class="indicateur-langue" title="Article en anglais : « Decimal data type »">(en)</span></a></li> <li><a href="/wiki/Virgule_fixe" title="Virgule fixe">Virgule fixe</a></li> <li><a href="/wiki/Virgule_flottante" title="Virgule flottante">Virgule flottante</a></li> <li><a href="/wiki/Entier_(informatique)" title="Entier (informatique)">Entier</a> <ul><li><a href="/w/index.php?title=Signedness&action=edit&redlink=1" class="new" title="Signedness (page inexistante)">Non signé</a> <a href="https://en.wikipedia.org/wiki/Signedness" class="extiw" title="en:Signedness"><span class="indicateur-langue" title="Article en anglais : « Signedness »">(en)</span></a></li></ul></li> <li><a href="/wiki/Arithm%C3%A9tique_d%27intervalles" title="Arithmétique d'intervalles">Intervalle</a></li> <li><a href="/w/index.php?title=Rational_data_type&action=edit&redlink=1" class="new" title="Rational data type (page inexistante)">Rationnel</a> <a href="https://en.wikipedia.org/wiki/Rational_data_type" class="extiw" title="en:Rational data type"><span class="indicateur-langue" title="Article en anglais : « Rational data type »">(en)</span></a></li></ul> </div></td> </tr> <tr> <th class="navbox-group" style=""><a href="/wiki/Texte_brut" title="Texte brut">Texte brut</a></th> <td class="navbox-list" style=""><div class="liste-horizontale"> <ul><li><a href="/wiki/Caract%C3%A8re_(informatique)" title="Caractère (informatique)">Caractère</a></li> <li><a href="/wiki/Cha%C3%AEne_de_caract%C3%A8res" title="Chaîne de caractères">Chaîne de caractères</a></li></ul> </div></td> </tr> <tr> <th class="navbox-group" style=""><a href="/wiki/Pointeur_(programmation)" title="Pointeur (programmation)">Pointeur</a></th> <td class="navbox-list navbox-even" style=""><div class="liste-horizontale"> <ul><li><a href="/wiki/Adressage_m%C3%A9moire" title="Adressage mémoire">Adressage mémoire</a> <ul><li><a href="/wiki/Adresse_physique" title="Adresse physique">Physique</a></li> <li><a href="/wiki/Adresse_virtuelle" title="Adresse virtuelle">Virtuelle</a></li></ul></li> <li><a href="/wiki/R%C3%A9f%C3%A9rence_(programmation)" title="Référence (programmation)">Référence</a></li></ul> </div></td> </tr> <tr> <th class="navbox-group" style=""><a href="/w/index.php?title=Composite_data_type&action=edit&redlink=1" class="new" title="Composite data type (page inexistante)">Composite</a> <a href="https://en.wikipedia.org/wiki/Composite_data_type" class="extiw" title="en:Composite data type"><span class="indicateur-langue" title="Article en anglais : « Composite data type »">(en)</span></a></th> <td class="navbox-list" style=""><div class="liste-horizontale"> <ul><li><a class="mw-selflink selflink">Type algébrique de données</a> <ul><li><a class="mw-selflink-fragment" href="#GADT">Généralisé</a></li></ul></li> <li><a href="/wiki/Tableau_(structure_de_donn%C3%A9es)" title="Tableau (structure de données)">Tableau</a></li> <li><a href="/wiki/Tableau_associatif" title="Tableau associatif">Tableau associatif</a></li> <li><a href="/wiki/Classe_(informatique)" title="Classe (informatique)">Classe</a></li> <li><a href="/wiki/Type_d%C3%A9pendant" title="Type dépendant">Dépendant</a></li> <li><a href="/w/index.php?title=Intuitionistic_type_theory&action=edit&redlink=1" class="new" title="Intuitionistic type theory (page inexistante)">Égalité</a> <a href="https://en.wikipedia.org/wiki/Intuitionistic_type_theory#Equality_type" class="extiw" title="en:Intuitionistic type theory"><span class="indicateur-langue" title="Article en anglais : « Intuitionistic type theory#Equality type »">(en)</span></a></li> <li><a href="/w/index.php?title=Inductive_type&action=edit&redlink=1" class="new" title="Inductive type (page inexistante)">Inductive</a> <a href="https://en.wikipedia.org/wiki/Inductive_type" class="extiw" title="en:Inductive type"><span class="indicateur-langue" title="Article en anglais : « Inductive type »">(en)</span></a></li> <li><a href="/wiki/Liste_(informatique)" title="Liste (informatique)">Liste</a></li> <li><a href="/wiki/Objet_(informatique)" title="Objet (informatique)">Objet</a> <ul><li><a href="/wiki/M%C3%A9taobjet" title="Métaobjet">Métaobjet</a></li></ul></li> <li><a href="/w/index.php?title=Option_type&action=edit&redlink=1" class="new" title="Option type (page inexistante)">Option</a> <a href="https://en.wikipedia.org/wiki/Option_type" class="extiw" title="en:Option type"><span class="indicateur-langue" title="Article en anglais : « Option type »">(en)</span></a></li> <li><a class="mw-selflink-fragment" href="#Type_produit">Produit</a> <ul><li><a href="/wiki/Enregistrement_(structure_de_donn%C3%A9es)" title="Enregistrement (structure de données)">Enregistrement</a></li></ul></li> <li><a href="/wiki/Ensemble_(informatique)" title="Ensemble (informatique)">Ensemble (set)</a></li> <li><a href="/wiki/Vecteur_(structure_de_donn%C3%A9es)" title="Vecteur (structure de données)">Vecteur</a></li> <li><a href="/w/index.php?title=Union_type&action=edit&redlink=1" class="new" title="Union type (page inexistante)">Union</a> <a href="https://en.wikipedia.org/wiki/Union_type" class="extiw" title="en:Union type"><span class="indicateur-langue" title="Article en anglais : « Union type »">(en)</span></a> <ul><li><a class="mw-selflink-fragment" href="#Type_somme">Disjointe</a></li></ul></li></ul> </div></td> </tr> <tr> <th class="navbox-group" style="">Autres</th> <td class="navbox-list navbox-even" style=""><div class="liste-horizontale"> <ul><li><a href="/wiki/Bool%C3%A9en" title="Booléen">Booléen</a></li> <li><a href="/wiki/Type_vide" title="Type vide">Type vide</a></li> <li><a href="/wiki/Collection_(type_de_donn%C3%A9es)" title="Collection (type de données)">Collection</a></li> <li><a href="/wiki/Conteneur_(informatique)" title="Conteneur (informatique)">Conteneur</a></li> <li><a href="/wiki/Type_%C3%A9num%C3%A9r%C3%A9" title="Type énuméré">Type énuméré</a></li> <li><a href="/wiki/Syst%C3%A8me_de_gestion_d%27exceptions" title="Système de gestion d'exceptions">Exception</a></li> <li><a href="/wiki/Routine_(informatique)" title="Routine (informatique)">Fonction</a></li> <li><a href="/w/index.php?title=Opaque_data_type&action=edit&redlink=1" class="new" title="Opaque data type (page inexistante)">Opaque</a> <a href="https://en.wikipedia.org/wiki/Opaque_data_type" class="extiw" title="en:Opaque data type"><span class="indicateur-langue" title="Article en anglais : « Opaque data type »">(en)</span></a></li> <li><a href="/wiki/Type_r%C3%A9cursif" title="Type récursif">Type récursif</a></li> <li><a href="/wiki/S%C3%A9maphore_(informatique)" title="Sémaphore (informatique)">Sémaphore</a></li> <li><a href="/wiki/Flux_(informatique)" title="Flux (informatique)">Flux</a></li> <li><a href="/w/index.php?title=Top_type&action=edit&redlink=1" class="new" title="Top type (page inexistante)">Top</a> <a href="https://en.wikipedia.org/wiki/Top_type" class="extiw" title="en:Top type"><span class="indicateur-langue" title="Article en anglais : « Top type »">(en)</span></a></li> <li><a href="/w/index.php?title=Type_class&action=edit&redlink=1" class="new" title="Type class (page inexistante)">Type class</a> <a href="https://en.wikipedia.org/wiki/Type_class" class="extiw" title="en:Type class"><span class="indicateur-langue" title="Article en anglais : « Type class »">(en)</span></a></li> <li><a href="/wiki/Type_unit%C3%A9" title="Type unité">Type unité</a></li> <li><a href="/wiki/Void" title="Void">Void</a></li></ul> </div></td> </tr> <tr> <th class="navbox-group" style="">Articles liés</th> <td class="navbox-list" style=""><div class="liste-horizontale"> <ul><li><a href="/wiki/Type_abstrait" title="Type abstrait">Type abstrait</a></li> <li><a href="/wiki/Structure_de_donn%C3%A9es" title="Structure de données">Structure de données</a></li> <li><a href="/wiki/G%C3%A9n%C3%A9ricit%C3%A9" title="Généricité">Généricité</a></li> <li><a href="/w/index.php?title=Kind_(type_theory)&action=edit&redlink=1" class="new" title="Kind (type theory) (page inexistante)">Kind</a> <a href="https://en.wikipedia.org/wiki/Kind_(type_theory)" class="extiw" title="en:Kind (type theory)"><span class="indicateur-langue" title="Article en anglais : « Kind (type theory) »">(en)</span></a> <ul><li><a href="/wiki/M%C3%A9taclasse" title="Métaclasse">Métaclasse</a></li></ul></li> <li><a href="/w/index.php?title=Parametric_polymorphism&action=edit&redlink=1" class="new" title="Parametric polymorphism (page inexistante)">Parametric polymorphism</a> <a href="https://en.wikipedia.org/wiki/Parametric_polymorphism" class="extiw" title="en:Parametric polymorphism"><span class="indicateur-langue" title="Article en anglais : « Parametric polymorphism »">(en)</span></a></li> <li><a href="/w/index.php?title=Primitive_data_type&action=edit&redlink=1" class="new" title="Primitive data type (page inexistante)">Primitive data type</a> <a href="https://en.wikipedia.org/wiki/Primitive_data_type" class="extiw" title="en:Primitive data type"><span class="indicateur-langue" title="Article en anglais : « Primitive data type »">(en)</span></a></li> <li><a href="/wiki/Interface_(programmation_orient%C3%A9e_objet)" title="Interface (programmation orientée objet)">Interface</a></li> <li><a href="/w/index.php?title=Subtyping&action=edit&redlink=1" class="new" title="Subtyping (page inexistante)">Subtyping</a> <a href="https://en.wikipedia.org/wiki/Subtyping" class="extiw" title="en:Subtyping"><span class="indicateur-langue" title="Article en anglais : « Subtyping »">(en)</span></a></li> <li><a href="/w/index.php?title=Type_constructor&action=edit&redlink=1" class="new" title="Type constructor (page inexistante)">Type constructor</a> <a href="https://en.wikipedia.org/wiki/Type_constructor" class="extiw" title="en:Type constructor"><span class="indicateur-langue" title="Article en anglais : « Type constructor »">(en)</span></a></li> <li><a href="/wiki/Conversion_de_type" title="Conversion de type">Conversion de type</a></li> <li><a href="/w/index.php?title=Type_system&action=edit&redlink=1" class="new" title="Type system (page inexistante)">Type system</a> <a href="https://en.wikipedia.org/wiki/Type_system" class="extiw" title="en:Type system"><span class="indicateur-langue" title="Article en anglais : « Type system »">(en)</span></a></li></ul> </div></td> </tr> </tbody></table> </div> <ul id="bandeau-portail" class="bandeau-portail"><li><span class="bandeau-portail-element"><span class="bandeau-portail-icone"><span class="noviewer" typeof="mw:File"><a href="/wiki/Portail:Programmation_informatique" title="Portail de la programmation informatique"><img alt="icône décorative" src="//upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Circle-icons-dev.svg/24px-Circle-icons-dev.svg.png" decoding="async" width="24" height="24" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Circle-icons-dev.svg/36px-Circle-icons-dev.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Circle-icons-dev.svg/48px-Circle-icons-dev.svg.png 2x" data-file-width="512" data-file-height="512" /></a></span></span> <span class="bandeau-portail-texte"><a href="/wiki/Portail:Programmation_informatique" title="Portail:Programmation informatique">Portail de la programmation informatique</a></span> </span></li> </ul> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐f69cdc8f6‐ckdzv Cached time: 20241124162013 Cache expiry: 2592000 Reduced expiry: false Complications: [show‐toc] CPU time usage: 0.270 seconds Real time usage: 0.343 seconds Preprocessor visited node count: 2551/1000000 Post‐expand include size: 104487/2097152 bytes Template argument size: 27478/2097152 bytes Highest expansion depth: 13/100 Expensive parser function count: 34/500 Unstrip recursion depth: 0/20 Unstrip post‐expand size: 21415/5000000 bytes Lua time usage: 0.096/10.000 seconds Lua memory usage: 5456642/52428800 bytes Number of Wikibase entities loaded: 1/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 263.455 1 -total 17.12% 45.100 1 Modèle:Palette 16.35% 43.072 1 Modèle:Ébauche 15.18% 40.005 1 Modèle:Palette_Types_de_données 14.47% 38.119 22 Modèle:Lien 14.18% 37.365 1 Modèle:Méta_palette_de_navigation 13.22% 34.839 1 Modèle:Portail 12.10% 31.877 1 Modèle:Voir_homonymes 11.40% 30.026 1 Modèle:Méta_bandeau_de_note 10.74% 28.304 1 Modèle:Méta_bandeau --> <!-- Saved in parser cache with key frwiki:pcache:idhash:1014977-0!canonical and timestamp 20241124162013 and revision id 217277222. 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?type=1x1" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Ce document provient de « <a dir="ltr" href="https://fr.wikipedia.org/w/index.php?title=Type_algébrique_de_données&oldid=217277222">https://fr.wikipedia.org/w/index.php?title=Type_algébrique_de_données&oldid=217277222</a> ».</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Cat%C3%A9gorie:Accueil" title="Catégorie:Accueil">Catégories</a> : <ul><li><a href="/wiki/Cat%C3%A9gorie:Programmation_fonctionnelle" title="Catégorie:Programmation fonctionnelle">Programmation fonctionnelle</a></li><li><a href="/wiki/Cat%C3%A9gorie:Th%C3%A9orie_des_types" title="Catégorie:Théorie des types">Théorie des types</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Catégories cachées : <ul><li><a href="/wiki/Cat%C3%A9gorie:Wikip%C3%A9dia:%C3%A9bauche_informatique" title="Catégorie:Wikipédia:ébauche informatique">Wikipédia:ébauche informatique</a></li><li><a href="/wiki/Cat%C3%A9gorie:Article_contenant_un_appel_%C3%A0_traduction_en_anglais" title="Catégorie:Article contenant un appel à traduction en anglais">Article contenant un appel à traduction en anglais</a></li><li><a href="/wiki/Cat%C3%A9gorie:Article_avec_une_section_vide_ou_incompl%C3%A8te" title="Catégorie:Article avec une section vide ou incomplète">Article avec une section vide ou incomplète</a></li><li><a href="/wiki/Cat%C3%A9gorie:Portail:Programmation_informatique/Articles_li%C3%A9s" title="Catégorie:Portail:Programmation informatique/Articles liés">Portail:Programmation informatique/Articles liés</a></li><li><a href="/wiki/Cat%C3%A9gorie:Portail:Informatique/Articles_li%C3%A9s" title="Catégorie:Portail:Informatique/Articles liés">Portail:Informatique/Articles liés</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"> La dernière modification de cette page a été faite le 1 août 2024 à 08:20.</li> <li id="footer-info-copyright"><span style="white-space: normal"><a href="/wiki/Wikip%C3%A9dia:Citation_et_r%C3%A9utilisation_du_contenu_de_Wikip%C3%A9dia" title="Wikipédia:Citation et réutilisation du contenu de Wikipédia">Droit d'auteur</a> : les textes sont disponibles sous <a rel="nofollow" class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.fr">licence Creative Commons attribution, partage dans les mêmes conditions</a> ; d’autres conditions peuvent s’appliquer. Voyez les <a class="external text" href="https://foundation.wikimedia.org/wiki/Policy:Terms_of_Use/fr">conditions d’utilisation</a> pour plus de détails, ainsi que les <a href="/wiki/Wikip%C3%A9dia:Cr%C3%A9dits_graphiques" title="Wikipédia:Crédits graphiques">crédits graphiques</a>. En cas de réutilisation des textes de cette page, voyez <a href="/wiki/Sp%C3%A9cial:Citer/Type_alg%C3%A9brique_de_donn%C3%A9es" title="Spécial:Citer/Type algébrique de données">comment citer les auteurs et mentionner la licence</a>.<br /> Wikipedia® est une marque déposée de la <a rel="nofollow" class="external text" href="https://wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, organisation de bienfaisance régie par le paragraphe <a href="/wiki/501c" title="501c">501(c)(3)</a> du code fiscal des États-Unis.</span><br /></li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy/fr">Politique de confidentialité</a></li> <li id="footer-places-about"><a href="/wiki/Wikip%C3%A9dia:%C3%80_propos_de_Wikip%C3%A9dia">À propos de Wikipédia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikip%C3%A9dia:Avertissements_g%C3%A9n%C3%A9raux">Avertissements</a></li> <li id="footer-places-contact"><a href="//fr.wikipedia.org/wiki/Wikipédia:Contact">Contact</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Code de conduite</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Développeurs</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/fr.wikipedia.org">Statistiques</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Déclaration sur les témoins (cookies)</a></li> <li id="footer-places-mobileview"><a href="//fr.m.wikipedia.org/w/index.php?title=Type_alg%C3%A9brique_de_donn%C3%A9es&mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Version mobile</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></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"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-6b7f745dd4-tdv75","wgBackendResponseTime":175,"wgPageParseReport":{"limitreport":{"cputime":"0.270","walltime":"0.343","ppvisitednodes":{"value":2551,"limit":1000000},"postexpandincludesize":{"value":104487,"limit":2097152},"templateargumentsize":{"value":27478,"limit":2097152},"expansiondepth":{"value":13,"limit":100},"expensivefunctioncount":{"value":34,"limit":500},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":21415,"limit":5000000},"entityaccesscount":{"value":1,"limit":400},"timingprofile":["100.00% 263.455 1 -total"," 17.12% 45.100 1 Modèle:Palette"," 16.35% 43.072 1 Modèle:Ébauche"," 15.18% 40.005 1 Modèle:Palette_Types_de_données"," 14.47% 38.119 22 Modèle:Lien"," 14.18% 37.365 1 Modèle:Méta_palette_de_navigation"," 13.22% 34.839 1 Modèle:Portail"," 12.10% 31.877 1 Modèle:Voir_homonymes"," 11.40% 30.026 1 Modèle:Méta_bandeau_de_note"," 10.74% 28.304 1 Modèle:Méta_bandeau"]},"scribunto":{"limitreport-timeusage":{"value":"0.096","limit":"10.000"},"limitreport-memusage":{"value":5456642,"limit":52428800}},"cachereport":{"origin":"mw-web.codfw.main-f69cdc8f6-ckdzv","timestamp":"20241124162013","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Type alg\u00e9brique de donn\u00e9es","url":"https:\/\/fr.wikipedia.org\/wiki\/Type_alg%C3%A9brique_de_donn%C3%A9es","sameAs":"http:\/\/www.wikidata.org\/entity\/Q1322511","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q1322511","author":{"@type":"Organization","name":"Contributeurs aux projets Wikimedia"},"publisher":{"@type":"Organization","name":"Fondation Wikimedia, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2006-09-07T19:46:04Z","dateModified":"2024-08-01T07:20:22Z"}</script> </body> </html>