In
functional languages, a data object containing two or more components. Also known as a product t
Ype or pair, triple, quad, etc. Tuples of different sizes have different t
Ypes, in contrast to lists where the t
Ype is independent of the length. The components of a tuple ma
Y be of different t
Ypes whereas all elements of a list have the same t
Ype. 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 t
Ype since it has onl
Y one possible value which is also written (). The implementation of tuples in a language ma
Y be either "
lifted" or not. If tuples are lifted then (bottom,bottom) /= bottom and the evaluation of a tuple ma
Y 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 t
Ypes with multiple constructors ({algebraic data t
Ype}s) - the expression being matched is evaluated as far as the top level constructor, even though, in the case of tuples, there is onl
Y one possible constructor for a given t
Ype. If tuples are unlifted then (bottom, bottom) = bottom and evaluation of a tuple will never fail to terminate though an
Y of the components ma
Y. E.g. in
Miranda: f (x,
Y) = 1 --> f bottom = 1 f (bottom,bottom) = 1 Thus in Miranda, an
Y object whose t
Ype 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 t
Ypes with onl
Y one constructor. In Haskell, patterns can be made irrefutable b
Y 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 an
Y x so matching a refutable pattern would fail to terminate if an
Y component was bottom.
Yle="border-width:thin; border-color:#333333; border-stYle:dashed; padding:5px;" align="left">In addition suitable contents:
[ 2 ] [ = ] [ ad ] [ ag ] [ ai ] [ al ] [ algebra ] [ algebraic ] [ algebraic data tYpe ] [ am ] [ an ] [ app ] [ ar ] [ arc ] [ arg ] [ argument ] [ as ] [ at ] [ av ] [ b ] [ be ] [ bj ] [ bo ] [ bot ] [ bottom ] [ br ] [ bY ] [ ca ] [ case ] [ ch ] [ co ] [ com ] [ compatible ] [ component ] [ con ] [ cons ] [ constructor ] [ data ] [ data tYpe ] [ dd ] [ de ] [ diff ] [ ding ] [ du ] [ E ] [ ec ] [ ed ] [ eg ] [ element ] [ er ] [ era ] [ es ] [ et ] [ evaluation ] [ expression ] [ fi ] [ file ] [ fo ] [ for ] [ function ] [ functional ] [ functional language ] [ ge ] [ gen ] [ generate ] [ gh ] [ gi ] [ gt ] [ gu ] [ h ] [ hing ] [ hose ] [ hr ] [ hu ] [ id ] [ ie ] [ iff ] [ il ] [ in ] [ inc ] [ io ] [ ir ] [ irrefutable ] [ is ] [ it ] [ ke ] [ kn ] [ la ] [ language ] [ ld ] [ Lex ] [ li ] [ list ] [ lists ] [ ls ] [ lt ] [ lu ] [ lY ] [ M ] [ ma ] [ Miranda ] [ mo ] [ mod ] [ module ] [ mp ] [ mu ] [ na ] [ nc ] [ ne ] [ ng ] [ ni ] [ nl ] [ no ] [ ns ] [ object ] [ om ] [ op ] [ pa ] [ pattern matching ] [ pe ] [ ph ] [ pl ] [ pr ] [ product ] [ quad ] [ querY ] [ rc ] [ re ] [ refutable ] [ ro ] [ ru ] [ sa ] [ sam ] [ se ] [ si ] [ sk ] [ so ] [ st ] [ strict ] [ struct ] [ su ] [ sum ] [ T ] [ table ] [ tc ] [ th ] [ to ] [ tr ] [ tt ] [ tw ] [ tYpe ] [ ua ] [ ug ] [ um ] [ up ] [ us ] [ user ] [ va ] [ value ] [ ve ] [ zero ] [ ~ ]