Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More examples? #8

Open
alphapapa opened this issue Mar 30, 2016 · 5 comments
Open

More examples? #8

alphapapa opened this issue Mar 30, 2016 · 5 comments

Comments

@alphapapa
Copy link

It would be helpful to have examples for each macro. :)

@jasonm23
Copy link

The test suite provides a complete set of examples. https://github.com/rolandwalker/anaphora/blob/master/ert-tests/anaphora-test.el

@jasonm23
Copy link

jasonm23 commented Oct 26, 2016

anaphoric-if aka. aif

Like if, but the result of evaluating COND is bound to it.

The variable it is available within THEN and ELSE.

COND, THEN, and ELSE are otherwise as documented for if.

anaphoric-prog1 aka. aprog1

Like prog1, but the result of evaluating FIRST is bound to it.

The variable it is available within BODY.

FIRST and BODY are otherwise as documented for prog1.

The final return value of aprog1 is it (ie. FIRST).

anaphoric-prog2 aka. aprog2

Like prog2, but the result of evaluating FORM2 is bound to it.

The variable it is available within BODY.

FORM1, FORM2, and BODY are otherwise as documented for prog2.

The final return value of aprog2 is it (ie. FORM2).

anaphoric-when aka. awhen

Like when, but the result of evaluating COND is bound to it.

The variable it is available within BODY.

COND and BODY are otherwise as documented for when.

anaphoric-while aka. awhile

Like while, but the result of evaluating TEST is bound to it.

The variable it is available within BODY.

TEST and BODY are otherwise as documented for while.

anaphoric-and aka. aand

Like and, but the result of the previous condition is bound to it.

The variable it is available within all CONDITIONS after the
initial one.

CONDITIONS are otherwise as documented for and.

Note that some implementations of this macro bind only the first
condition to it, rather than each successive condition.

anaphoric-cond aka. acond

Like cond, but the result of each condition is bound to it.

The variable it is available within the remainder of each of CLAUSES.

CLAUSES are otherwise as documented for cond.

anaphoric-lambda aka. alambda

Like lambda, but the function may refer to itself as self.

ARGS and BODY are otherwise as documented for lambda.

anaphoric-block aka. ablock

Like block, but the result of the previous expression is bound to it.

The variable it is available within all expressions of BODY
except the initial one.

NAME and BODY are otherwise as documented for block.

anaphoric-case aka. acase

Like case, but the result of evaluating EXPR is bound to it.

The variable it is available within CLAUSES.

EXPR and CLAUSES are otherwise as documented for case.

anaphoric-ecase aka. aecase

Like ecase, but the result of evaluating EXPR is bound to it.

The variable it is available within CLAUSES.

EXPR and CLAUSES are otherwise as documented for ecase.

anaphoric-typecase aka. atypecase

Like typecase, but the result of evaluating EXPR is bound to it.

The variable it is available within CLAUSES.

EXPR and CLAUSES are otherwise as documented for typecase.

anaphoric-etypecase aka. aetypecase

Like etypecase, but result of evaluating EXPR is bound to it.

The variable it is available within CLAUSES.

EXPR and CLAUSES are otherwise as documented for etypecase.

anaphoric-let aka. alet

Like let, but the content of VARLIST is bound to it.

VARLIST as it appears in it is not evaluated. The variable it
is available within BODY.

VARLIST and BODY are otherwise as documented for let.

anaphoric-+ aka. a+

Like +, but the result of evaluating the previous expression is bound to it.

The variable it is available within all expressions after the
initial one.

NUMBERS-OR-MARKERS are otherwise as documented for +.

anaphoric-- aka. a-

Like -, but the result of evaluating the previous expression is bound to it.

The variable it is available within all expressions after the
initial one.

NUMBER-OR-MARKER and NUMBERS-OR-MARKERS are otherwise as
documented for -.

anaphoric-* aka. a*

Like *, but the result of evaluating the previous expression is bound to it.

The variable it is available within all expressions after the
initial one.

NUMBERS-OR-MARKERS are otherwise as documented for *.

anaphoric-/ aka. a/

Like /, but the result of evaluating the previous divisor is bound to it.

The variable it is available within all expressions after the
first divisor.

DIVIDEND, DIVISOR, and DIVISORS are otherwise as documented for /.

anaphoric-set

EXPERIMENTAL

Like set, except that the value of SYMBOL is bound to it.

The variable it is available within VALUE.

SYMBOL and VALUE are otherwise as documented for set.

Note that if this macro followed traditional naming for
anaphoric expressions, it would conflict with the existing
(quite different) function aset.

anaphoric-setq

EXPERIMENTAL

Like setq, except that the value of SYM is bound to it.

The variable it is available within each VAL.

ARGS in the form [SYM VAL] ... are otherwise as documented for setq.

No alias asetq is provided, because it would be easily mistaken
for the pre-existing aset, and because anaphoric-setq is not
likely to find frequent use.

@alphapapa
Copy link
Author

It would be great if these were in the documentation. :)

@jasonm23
Copy link

@alphapapa there's a couple of pull requests already open.

@jasonm23
Copy link

@alphapapa Wiki now has these docs too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants