Search: in
Tacit programming
Tacit programming in Encyclopedia Encyclopedia
  Tutorials     Encyclopedia     Videos     Books     Software     DVDs  
       





Tacit programming

Tacit programming is a programming paradigm in which a function definition does not include information regarding its arguments, using combinators and function composition (but not -abstraction) instead of variables. The simplicity behind this idea allows its use on several programming languages, such as APL and J and especially in stack or concatenative languages, such as PostScript, Forth, Joy, and Factor. Outside of the APL and J communities, tacit programming is referred to as point-free style,[1] or more pithily as pointless programming, because of the lack of explicit arguments, or points.

The key idea in tacit programming is to assist in operating at the appropriate level of abstraction. That is, to translate the natural transformation given by currying:

\hom(A\times B, C) \equiv \hom(A,\hom(B,C))

into computer functions, where the left represents the uncurried form of a function and the right the curried. hom(X,Y) denotes the homomorphisms from X to Y while, A x B denotes the Cartesian product of A and B.

Contents


Examples

Functional programming

A simple example (in Haskell) is a program which takes a sum of a list. A programmer might define a sum recursively using a pointed (cf. value-level programming) method as:

However by noting this as a fold the programmer could replace this with:

and then the argument is not needed so this can be replaced with

which is point-free.

Another example is the use of the dot operator:

we can simply group

so

Finally to see a complex example imagine a map filter program which takes a list, applies a function to it, and then filters the elements based on a criterion

can be expressed point-free[2] as

APL family

In J, the same sort of point-free code occurs in a function made to compute the average of a list (array) of numbers: avg=: +/ % # # counts the number of items in the array. +/ sums the items of the array. % divides the sum by the number of items

Stack-based

In stack-oriented programming languages (and concatenative ones, most of which are stack based), point-free methods are commonly used. For example a procedure to compute the Fibonacci numbers might look like:

/fib {    dup dup 1 eq exch 0 eq or not    {       dup 1 sub fib       exch 2 sub fib       add    } if } def  

See also

References

External links

es:Programaci n t cita






Source: Wikipedia | The above article is available under the GNU FDL. | Edit this article



Search for Tacit programming in Tutorials
Search for Tacit programming in Encyclopedia
Search for Tacit programming in Videos
Search for Tacit programming in Books
Search for Tacit programming in Software
Search for Tacit programming in DVDs
Search for Tacit programming in Store




Advertisement




Tacit programming in Encyclopedia
Tacit_programming top Tacit_programming

Home - Add TutorGig to Your Site - Disclaimer

©2011-2013 TutorGig.info All Rights Reserved. Privacy Statement