Common Lisp Package: YACLANAPHT

Collection of anaphoric macros from 'On Lisp' and 'Let Over Lambda'. Distinct feature is that it interns IT (and other anaphoric symbols) directly into callee-package's namespace.

README:

anaphora

Yet another anaphoric macro package. Why?

Currently (as of 2013/02/24) other available anaphoric macro packages do not allow the following sequence of steps to work.

    CL-USER> (ql:quickload 'yaclanapht)  
    CL-USER> (yaclanapht:aif (+ 1 2) it 6)  
    3 

For things to work correctly, you should use the package, which basicaly means, that you should create your own package, which prohibits script-like programming style, found in Perl or Python.

This package is intended to fill the gap. With it, abovewritten code works just as intended (i.e., works). It does so by interning IT during macroexpansion in the caller's package, not definer's.

To make this not-using style even more convenient, nickname "A" is chosen for this package. I believe, that in this case this is justifiable, since there isn't really other clear candidate for the name except anaphoric macro collection package.

Also, some macros, found in classic books ("On Lisp", "Let over Lambda") work as described there (for example, ALET), and not in some trivial noninteresting way.

TODO: 1) include analogs of all macros in ANAPHORA 2) include DEFANAPH from "On Lisp" 3) include ALET and ALET-FSM from "LOL" 4) include xyz-lambda reader macro.

MACRO

Public

Undocumented

AIF (TEST THEN &OPTIONAL ELSE)

Private

AAND (&REST CLAUSES)

Binds IT to the subsequent return-values of clauses. Such that for each clause, return-value of previous one is accessible through IT.

AANDL (&REST CLAUSES)

Like AAND, but IT is gradually consed list of return-values of clauses.

APIF (OP TEST THEN &OPTIONAL ELSE)

Anaphoric-predicative if (i.e. it binds IT to test, then uses OP to determine whether to go to THEN or ELSE.

Undocumented

AWHEN (TEST &BODY BODY)