tuple
元组
元组
tuple 有序
n 元;
n 重序元
tuple n 倍;
n 元组;
n 元数;
n 元向量
tuple 重元组
tuple 元
In {
functional languages },
a data object containing two or
more components .
Also known as a product type or pair ,
triple ,
quad ,
etc .
Tuples of different sizes have different
types ,
in contrast to lists where the type is independent of
the length .
The components of a tuple may be of different
types whereas all elements of a list have the same type .
Examples of tuples in {
Haskell }
notation are (
1 ,
2 ),
("
Tuple ",
True ), (
w ,(
x ,
y ),
z ).
The degenerate tuple with zero
components ,
written (),
is known as the unit type since it has
only one possible value which is also written ().
The implementation of tuples in a language may be either
"{
lifted }"
or not .
If tuples are lifted then (
bottom ,
bottom )
/=
bottom and the evaluation of a tuple may fail to terminate .
E .
g .
in Haskell :
f (
x ,
y ) =
1 -->
f bottom =
bottom
f (
bottom ,
bottom ) =
1
With lifted tuples ,
a tuple pattern is refutable .
Thus in
Haskell , {
pattern matching }
on tuples is the same as pattern
matching on types with multiple constructors ({
algebraic data
types }) -
the expression being matched is evaluated as far as
the top level constructor ,
even though ,
in the case of tuples ,
there is only one possible constructor for a given type .
If tuples are unlifted then (
bottom ,
bottom ) =
bottom and
evaluation of a tuple will never fail to terminate though any
of the components may .
E .
g .
in {
Miranda }:
f (
x ,
y ) =
1 -->
f bottom =
1
f (
bottom ,
bottom ) =
1
Thus in Miranda ,
any object whose type is compatible with a
tuple pattern is assumed to match at the top level without
evaluation -
it is an {
irrefutable }
pattern .
This also
applies to user defined data types with only one constructor .
In Haskell ,
patterns can be made irrefutable by adding a "~"
as in
f ~(
x ,
y ) =
1 .
If tuple constructor functions were {
strict }
in all their
arguments then (
bottom ,
x ) = (
x ,
bottom ) =
bottom for any x so
matching a refutable pattern would fail to terminate if any
component was bottom .
安装中文字典英文字典查询工具!
中文字典英文字典工具:
复制到剪贴板
英文字典中文字典相关资料:
Microsoft – AI, Cloud, Productivity, Computing, Gaming Apps Explore Microsoft products and services and support for your home or business Shop Microsoft 365, Copilot, Teams, Xbox, Windows, Azure, Surface and more
Sign in to your account - outlook. office. com Securely sign in to access your Microsoft account and manage emails, calendars, and other services efficiently
Sign in to your account Access and manage your Microsoft account, subscriptions, and settings all in one place
Microsoft account | Sign In or Create Your Account Today – Microsoft Get access to free online versions of Outlook, Word, Excel, and PowerPoint
Microsoft Office Locations | About Microsoft Learn about Microsoft headquarters in Redmond, WA and our offices, locations, and experience centers across the United States
Sign in to your account - myaccount. microsoft. com Sign in to manage your Microsoft account and access free online services like Outlook, Word, Excel, and PowerPoint securely from any device
Microsoft Support Microsoft Support is here to help you with Microsoft products Find how-to articles, videos, and training for Microsoft Copilot, Microsoft 365, Windows 11, Surface, and more
Download Drivers Updates for Microsoft, Windows and more - Microsoft . . . The official Microsoft Download Center Featuring the latest software updates and drivers for Windows, Office, Xbox and more Operating systems include Windows, Mac, Linux, iOS, and Android
Contact Us - Microsoft Support Contact Microsoft Support Find solutions to common problems, or get help from a support agent
Microsoft 365 for Individuals: Subscription for Productivity Apps Microsoft 365 (formerly Office 365) subscriptions offer a suite of productivity tools and cloud services with world-class security and powerful AI Try for free