Tupling


A program transformation where several results are returned from a single traversal of a data structure. E.g.
mean l = sum l / length l
==>
mean l = s/n where (s,n) = sumLen l
sumLen [] = (0,0) sumLen (x:xs) = (s+x, n+1) where (s,n) = sumLen xs
In procedural languages this technique is known as horizontal loop combination because it uses one loop to calculate several results.
Another form of tupling transformation is used to avoid repeated evaluation where a function generates several identical calls to itself. By analysing the pattern of recursion (see descent function) it is possible to arrange for these identical calls to share results. E.g.
fib 0 = 1 fib 1 = 1 fib n = fib (n-1) + fib (n-2)
==>
fib n = v where (_,v) = fibt n fibt 0 = (1,1) fibt n = (u+v,u) where (u,v) = fibt (n-1)
(1995-01-12)

Read Also:

  • Tuple space smalltalk

    [“Using Tuple Space Communication in Distributed Object-Oriented Languages”, S. Matsuoka et al, SIGPLAN Notices 23(11):276-284 (Nov 1988)]. (1994-11-08)

  • Tuppence

    noun, British. 1. twopence. noun, plural twopence, twopences for 2–4. 1. (used with a singular or plural verb) British. a sum of two pennies. 2. a bronze coin of the United Kingdom equal to two pennies: issued after decimalization in 1971. 3. a former copper coin of Great Britain, equal to two pennies, issued under […]

  • Tuppenny

    adjective 1. twopenny (defs 1–3). adjective 1. a variant spelling of twopenny

  • Tupper

    noun 1. Sir Charles, 1821–1915, Canadian statesman: prime minister 1896.

  • Tupperware

    noun 1. trademark a range of plastic containers used for storing food noun a trademarked type of plastic tight-sealing food container Usage Note proprietary cooking


Disclaimer: Tupling definition / meaning should not be considered complete, up to date, and is not intended to be used in place of a visit, consultation, or advice of a legal, medical, or any other professional. All content on this website is for informational purposes only.