8 Unsafe for Clause Transforms

▼ |  | Syntax: Meta-Programming Helpers

1 | Parsing and Specifying Syntax
2 | Syntax Object Helpers
3 | Datum Pattern Matching
4 | Module-Processing Helpers
5 | Macro Transformer Helpers
6 | Reader Helpers
7 | Parsing for Bodies
8 | Unsafe for Clause Transforms
9 | Source Locations
10 | Preserving Source Locations
11 | Non-Module Compilation And Expansion
12 | Trusting Standard Recertifying Transformers
13 | Attaching Documentation to Exports
14 | Contracts for Macro Subexpressions
15 | Macro Testing
16 | Internal-Definition Context Helpers
| Index

On this page:

expand-for-clause*
expand-for-clause

8.18
top contents ← prev up next →

## 8 Unsafe for Clause Transforms🔗ℹ

(require syntax/unsafe/for-transform) | package: base

The syntax/unsafe/for-transform module provides a helper function that gives access to the sequence transformers defined by define-sequence-syntax. This is what the for forms use and enables faster sequence traversal than what the sequence interface provides.
The output may use unsafe operations.

> procedure (expand-for-clause* orig-stx clause) → syntax?
> orig-stx : syntax?
> clause : syntax?

Expands a for clause of the form [(x ...) seq-expr], where x are identifiers, to:

> (([(outer-id ...) outer-expr] ...)
> outer-check
> ([loop-id loop-expr] ...)
> pos-guard
> ([(inner-id ...) inner-expr] ...)
> inner-check
> pre-guard
> post-guard
> (loop-arg ...))

which can then be spliced into the appropriate iterations. See :do-in for more information.

The result may use unsafe operations.

The first argument orig-stx is used only for reporting syntax errors.

Added in version 8.10.0.3 of package base.

> procedure (expand-for-clause orig-stx clause) → syntax?
> orig-stx : syntax?
> clause : syntax?

Like expand-for-clause*, but the result omits a inner-check part:

> (([(outer-id ...) outer-expr] ...)
> outer-check
> ([loop-id loop-expr] ...)
> pos-guard
> ([(inner-id ...) inner-expr] ...)
> pre-guard
> post-guard
> (loop-arg ...))

If a clause expands to a inner-check clauses that is not ignorable, expand-for-clause reports an error. An ignorable clause is (void) or a begin form wrapping ignorable clauses.

top contents ← prev up next →