Higher-Order and Symbolic Computation

, Volume 18, Issue 3, pp 299–326

Fixing Letrec: A Faithful Yet Efficient Implementation of Scheme's Recursive Binding Construct

Article

DOI: 10.1007/s10990-005-4878-3

Cite this article as:
Waddell, O., Sarkar, D. & Dybvig, R.K. Higher-Order Symb Comput (2005) 18: 299. doi:10.1007/s10990-005-4878-3

Abstract

A Scheme letrec expression is easily converted into more primitive constructs via a straightforward transformation given in the Revised5 Report. This transformation, unfortunately, introduces assignments that can impede the generation of efficient code. This article presents a more judicious transformation that preserves the semantics of the revised report transformation and also detects invalid references and assignments to left-hand-side variables, yet enables the compiler to generate efficient code. A variant of letrec that enforces left-to-right evaluation of bindings is also presented and shown to add virtually no overhead.

Keywords

letrec restriction recursive binding construct internal definitions modules mutual recursion optimization Scheme 

Copyright information

© Springer Science + Business Media, Inc. 2005

Authors and Affiliations

  • Oscar Waddell
    • 1
  • Dipanwita Sarkar
    • 1
  • R. Kent Dybvig
    • 1
  1. 1.Indiana UniversityBloomingtonUSA

Personalised recommendations