The letrec Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The letrec Reference Manual

This is the letrec Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 04:58:03 2022 GMT+0.

Table of Contents


1 Introduction

                                LETREC
                                ======

                             Robert Smith


INTRODUCTION
------------

LETREC:LETREC is a macro which aims to imitate Scheme's letrec
form. It is a useful construct for functional programming in Common
Lisp, where you have function-producing forms which need to be
functionally bound to a symbol.


EXAMPLE
-------

The following code

  (defun multiplier (n)
    (lambda (x) (* n x)))

  (letrec ((double (multiplier 2))
           (triple (multiplier 3)))
    (double (triple 5)))

produces

  30.

Another example:

  (letrec:letrec ((double (multiplier 2)))
    (double (funcall #'double 5)))

produces

  20.


ISSUES
------

Unforunately, the macro isn't a very efficient implementation. There
is a level of indirection with the function calling. Essentially, a
LETREC with the binding

  (name fn)

is expanded to a LABELS binding of the form

  (name (&rest args)
    (apply fn args))

which is somewhat abysmal.

Patches are welcome for implementation-specific ways of implementing
the macro.

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 letrec

A simple alternative to Scheme’s LETREC.

Author

Robert Smith <quad@symbo1ics.com>

License

Public Domain. See LICENSE.

Dependency

alexandria (system).

Source

letrec.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 letrec/letrec.asd

Source

letrec.asd.

Parent Component

letrec (system).

ASDF Systems

letrec.


3.1.2 letrec/package.lisp

Source

letrec.asd.

Parent Component

letrec (system).

Packages

letrec.


Previous: , Up: Lisp   [Contents][Index]

3.1.3 letrec/letrec.lisp

Dependency

package.lisp (file).

Source

letrec.asd.

Parent Component

letrec (system).

Public Interface

letrec (macro).

Internals

check-definitions (function).


4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 letrec

Source

package.lisp.

Use List

common-lisp.

Public Interface

letrec (macro).

Internals

check-definitions (function).


5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Macros

Macro: letrec ((&rest definitions) &body body)

A macro imitation of Scheme’s LETREC. Bindings should be of the form

(NAME FUNCTION-FORM)

where NAME is a symbol and FUNCTION-FORM is any function-producing form.

Package

letrec.

Source

letrec.lisp.


5.2 Internals


Previous: , Up: Internals   [Contents][Index]

5.2.1 Ordinary functions

Function: check-definitions (definitions)
Package

letrec.

Source

letrec.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   C   F   L   M  
Index Entry  Section

C
check-definitions: Private ordinary functions

F
Function, check-definitions: Private ordinary functions

L
letrec: Public macros

M
Macro, letrec: Public macros

Jump to:   C   F   L   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables