There and back again

被引:2
|
作者
Danvy, O [1 ]
Goldberg, M
机构
[1] Univ Aarhus, Dept Comp Sci, BRICS, DK-8000 Aarhus C, Denmark
[2] Ben Gurion Univ Negev, Dept Comp Sci, IL-84105 Beer Sheva, Israel
关键词
D O I
10.1145/583852.581500
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
We present a programming pattern where a recursive function traverses a data structure-typically a list-at return time. The idea is that the recursive calls get us there (typically to a base case) and the returns get us back again while traversing the data structure: We name this programming pattern of traversing a data structure at return time "There And Back Again" (TABA): The TABA pattern directly applies to computing a symbolic convolution. It also synergizes well-with other programming patterns, e.g., dynamic programming and traversing a list at double speed. We illustrate TABA and dynamic programming with Catalan numbers. We illustrate TABA and traversing a list at double speed with palindromes and we obtain a novel solution to this traditional exercise. A TABA-based function written in direct style makes full use of an Algol-like control stack and needs no heap allocation. Conversely, in a TABA-based function written in continuation-passing style, the continuation acts as a list iterator. In general, the TABA pattern saves one from constructing intermediate lists in reverse order.
引用
收藏
页码:230 / 234
页数:5
相关论文
共 50 条
  • [1] 'Back together again' again
    Callicott, JB
    ENVIRONMENTAL VALUES, 1998, 7 (04) : 461 - 475
  • [2] Coming back again, again, and yet again
    Milian Soria, Javier
    Salvador Suarez, Francisco Jose
    EMERGENCIAS, 2015, 27 (05): : 285 - 286
  • [3] There and back again
    John Boyle
    Nature Biotechnology, 2013, 31 : 13 - 15
  • [4] There and Back Again
    Hays-Gilpin, Kelley A.
    Gilpin, Dennis A.
    Eckert, Suzanne L.
    Ware, John A.
    Phillips, David A., Jr.
    Franklin, Hayward H.
    Ballagh, Jean H.
    INTERACTION AND CONNECTIVITY IN THE GREATER SOUTHWEST, 2019, : 63 - 81
  • [5] Back again
    Maia-Nussbaumer, Paivi de Jesus
    SCHWEIZER ARCHIV FUR TIERHEILKUNDE, 2017, 159 (05): : 255 - 255
  • [6] There and back again
    Bell, Irvine
    PROFESSIONAL ENGINEERING, 2009, 22 (01) : 17 - 17
  • [7] There and back again
    Danvy, O
    Goldberg, M
    FUNDAMENTA INFORMATICAE, 2005, 66 (04) : 397 - 413
  • [8] There and back again
    Leitch, David G.
    EUROPEAN JOURNAL OF POLITICAL THEORY, 2016, 15 (04) : 467 - 476
  • [9] BACK AGAIN
    WILSON, PR
    CLINICAL JOURNAL OF PAIN, 1995, 11 (02): : 89 - 90
  • [10] There and back again
    Bonora, A
    SOLID STATE TECHNOLOGY, 1997, 40 (05) : 141 - &