# Jensen's Device - Description

Description

Jensen's device exploits call by name and side-effects. Call by name is an argument passing convention that delays the evaluation of an argument until it is actually used in the procedure (a consequence of the copy rule for procedures). Algol introduced call by name.

A classic example of Jensen's device is a procedure that computes the sum of a series, :

real procedure Sum(k, l, u, ak) value l, u; integer k, l, u; real ak; comment k and ak are passed by name; begin real s; s := 0; for k := l step 1 until u do s := s + ak; Sum := s end;

In the procedure, the index variable `k` and summation term `ak` are passed by name. Call by name enables the procedure to change the value of the index variable during execution of the `for` loop. Call by name also causes the `ak` argument to be reevaluated during each iteration of the loop. Typically, `ak` will depend upon the changing (side-effected) `k`.

For example, code to compute the first 100 terms of a real array `V` would be:

Sum(i, 1, 100, V).

During the execution of `Sum`, the actual argument `i` will increment during each step of the `for` loop, and each of the procedure's evaluations of `ak` will use the current value of `i` to access the successive array elements `V`.

Jensen's device is general. A double summation can be done as:

Sum(i, l, m, Sum(j, l, n, A))

The `Sum` function can be employed for arbitrary functions merely by employing the appropriate expressions. If a sum of integers were desired the expression would be just `Sum(i,1,100,i);`, if a sum of squares of integers, then `Sum(i,1,100,i*i);`, and so on. A slight variation would be suitable for initiating a numerical integration of an expression by a method very similar to that of `Sum`.

The evaluation of `ak` is implemented with a thunk, which is essentially a subroutine with an environment. The thunk is a closure with no arguments. Each time a procedure needs the value of its formal argument, it simply calls the thunk. The thunk evaluates the actual argument in the scope of the calling code (not the scope of the procedure).

In the absence of this pass-by-name facility, it would be necessary to define functions embodying those expressions to be passed according to the protocols of the computer language, or to create a compendium function along with some arrangement to select the desired expression for each usage.

### Other articles related to "description, descriptions":

Gerald Of Wales - Natural History
... He gives a vivid and accurate description of the last colony of the European Beaver in Wales on the River Teifi, but spoils it by repeating the legend that beavers castrate ... Likewise he gives a good description of an Osprey fishing, but adds the mythical detail that the bird has one webbed foot ... His description of Irish wildlife was harshly called "worthless" the better view perhaps is that despite its faults it gives a valuable glimpse of Irish fauna in ...
Essay - Forms and Styles - Descriptive
... descriptive language, and organizing the description are the rhetorical choices to be considered when using a description ... A description is usually arranged spatially but can also be chronological or emphatic ... The focus of a description is the scene ...
Universal Description Discovery And Integration
... Universal Description, Discovery and Integration (UDDI, pronounced Yu-diː) is a platform-independent, Extensible Markup Language (XML)-based registry by which businesses worldwide can list ... It is designed to be interrogated by SOAP messages and to provide access to Web Services Description Language (WSDL) documents describing the protocol bindings and message formats required to ...
History of Knowledge of Ventricular Fibrillation
... Whether this is a description of ventricular fibrillation is debatable ... The next recorded description occurs 3000 years later and is recorded by Vesalius, who described the appearance of "worm-like" movements of the heart in animals prior to death ... clinical importance of these observations and descriptions possibly of ventricular fibrillation were not recognised until John Erichsen in 1842 described ventricular fibrillation ...
Meta Element Used in Search Engine Optimization - The `description` Attribute
... Unlike the keywords attribute, the description attribute is supported by most major search engines, like Yahoo! and Bing, while Google will fall back ... The description attribute provides a concise explanation of a Web page's content ... This allows the Web page authors to give a more meaningful description for listings than might be displayed if the search engine was unable to automatically create its own description based on the page ...

### Famous quotes containing the word description:

God damnit, why must all those journalists be such sticklers for detail? Why, they’d hold you to an accurate description of the first time you ever made love, expecting you to remember the color of the room and the shape of the windows.
Lyndon Baines Johnson (1908–1973)

Once a child has demonstrated his capacity for independent functioning in any area, his lapses into dependent behavior, even though temporary, make the mother feel that she is being taken advantage of....What only yesterday was a description of the child’s stage in life has become an indictment, a judgment.
Elaine Heffner (20th century)

The Sage of Toronto ... spent several decades marveling at the numerous freedoms created by a “global village” instantly and effortlessly accessible to all. Villages, unlike towns, have always been ruled by conformism, isolation, petty surveillance, boredom and repetitive malicious gossip about the same families. Which is a precise enough description of the global spectacle’s present vulgarity.
Guy Debord (b. 1931)