Skip to content

Commit

Permalink
support more atomic rewriting
Browse files Browse the repository at this point in the history
  • Loading branch information
pnwamk committed Mar 17, 2018
1 parent bd9d670 commit 30c9919
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions redex-doc/redex/scribblings/ref/typesetting.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -1048,18 +1048,18 @@ The @racket[proc] must match the contract @racket[(-> lw? lw?)].
Its result should be the rewritten version version of the input.
}
@defform[(with-atomic-rewriter name-symbol
@defform[(with-atomic-rewriter atom
string-or-thunk-returning-pict
expression)]{
Extends the current set of atomic-rewriters with one
new one that rewrites the value of name-symbol to
new one that rewrites the value of atom to
@racket[string-or-pict-returning-thunk] (applied, in the case of a
thunk), during the evaluation of expression.
@racket[name-symbol] is expected to evaluate to a symbol. The value
of @racket[string-or-thunk-returning-pict] is used whenever the symbol
appears in a pattern.
@racket[atom] is expected to evaluate to a symbol, boolean, number,
or string. The value of @racket[string-or-thunk-returning-pict] is
used that atom appears in a pattern.
@ex[
(define-language lam-lang
Expand Down
4 changes: 2 additions & 2 deletions redex-pict-lib/redex/private/core-layout.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
(syntax-parse stx
[(_ ([name transformer] ...) e:expr)
#:declare name
(expr/c #'symbol?
(expr/c #'(or/c symbol? boolean? number? string?)
#:name "atomic-rewriter name")
#:declare transformer
(expr/c #'(or/c (-> pict?) string?)
Expand Down Expand Up @@ -818,7 +818,7 @@
[(assoc e (atomic-rewrite-table))
=>
(λ (m)
(when (eq? (cadr m) e)
(when (equal? (cadr m) e)
(error 'apply-rewrites "rewritten version of ~s is still ~s" e e))
(let ([p (cadr m)])
(if (procedure? p)
Expand Down

0 comments on commit 30c9919

Please sign in to comment.