Skip to main content

Daniel Jomphe's Library tagged learning   View Popular

30 Dec 08

The Concepts and Confusions of Prefix, Infix, Postfix and Fully Nested Notations

  • In LISP languages, they use a notation like “(+ 1 2)” to mean
    “1+2”. Likewise, they write “(if test this that)” to mean “if (test)
    {this} else {that}”. LISP codes are all of the form “(a b c ...)”,
    where the a b c themselves may also be of that form. There is a wide
    misunderstanding that this notation being “prefix notation”.
  • LISP
    notation is a Functional Notation and calling it “prefix notation” is misleading and misconception at a fundamental level.
  • 19 more annotations...
17 Dec 08

tail calls in the VM : John Rose @ Sun

  • Tail-calling is an old idea; see the MIT “Lambda the Ultimate” papers. It is usually treated as an optimization. If A calls B calls C, and the last action of B is to call C, then the machine resources (such as stack) are adjusted so that it is as if A had directly called C. In effect, B pops its stack frame back to A, pushes arguments to C, and jumps to C, so that when C pops its arguments and returns, it branches directly back to A.
  • This optimization can save instructions, stack space, and instruction cache activity, so it is often found in compilers. But as long as it’s only an elective optimization of what’s really just a recursive call, it matters only as a performance hack. Call this hack “soft tail call”.
  • 1 more annotations...

Bug ID: 4726340 RFE: Tail Call Optimization

  • Suppose function A calls function B, and function B, as its
    last action, calls function C. The call to C is a "tail-
    call" because it occurs in the "tail" position (at the end)
    of function B.
  • When this happens, function B's call frame remains on the
    stack, preventing any of B's temporary objects from being
    garbage-collected, and also consuming stack space. When
    function C returns, function B will simply return the same
    value to A that C returned to B. The extra return also
    wastes a few nanoseconds.
  • 4 more annotations...
1 - 20 of 148 Next › Last »
Showing 20 items per page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo