dev-srcloc
Matthew Butterick 8 years ago
parent c0508aaea3
commit 0d55aeac82

@ -264,4 +264,9 @@
(define-macro-cases no-else-macro
[(_ ARG) #''got-arg])
(check-exn exn:fail:syntax? (λ _ (expand-once #'(no-else-macro 'arg1 'arg2)))))
(check-exn exn:fail:syntax? (λ _ (expand-once #'(no-else-macro 'arg1 'arg2)))))
(define-macro (define-unhygienic-macro (ID PAT ...) BODY ... STX-OBJECT)
#'(define-macro (ID PAT ...)
BODY ...
(datum->syntax caller-stx (syntax->datum STX-OBJECT))))

@ -1,11 +1,11 @@
#lang racket/base
(require racket/provide racket/list racket/string racket/format racket/match racket/port
br/define br/syntax br/datum br/debug br/cond racket/class racket/vector
(for-syntax racket/base racket/syntax br/syntax br/debug br/define))
(for-syntax racket/base racket/syntax br/syntax br/debug br/define br/datum))
(provide (all-from-out racket/base)
(all-from-out racket/list racket/string racket/format racket/match racket/port
br/syntax br/datum br/debug br/cond racket/class racket/vector br/define)
(for-syntax (all-from-out racket/base racket/syntax br/syntax br/debug))
(for-syntax (all-from-out racket/base racket/syntax br/syntax br/debug br/datum))
(for-syntax caller-stx with-shared-id)) ; from br/define
;; todo: activate at-exp reader by default

@ -4,7 +4,7 @@
@(require scribble/eval)
@(define my-eval (make-base-eval))
@(my-eval `(require br racket/stxparam))
@(my-eval `(require br racket/stxparam (for-syntax br)))
@title[#:style 'toc]{Beautiful Racket}
@ -426,3 +426,27 @@ Bind pattern variables within each @racket[stx-pattern] by matching the pattern
(m ((1 2) (3 4) (5 6)))
]
}
@defform[(prefix-id prefix id)]{
Create a new identifier within the lexical context of @racket[id] with the same name, but prefixed with @racket[prefix].
@examples[#:eval my-eval
(define-macro ($-define ID VAL)
(with-pattern ([PREFIXED-ID (prefix-id '$ #'ID)])
#'(define PREFIXED-ID VAL)))
($-define foo 42)
$foo
]
}
@defform[(suffix-id id suffix)]{
Create a new identifier within the lexical context of @racket[id] with the same name, but suffixed with @racket[suffix].
@examples[#:eval my-eval
(define-macro (define-% ID VAL)
(with-pattern ([ID-SUFFIXED (suffix-id #'ID '%)])
#'(define ID-SUFFIXED VAL)))
(define-% foo 42)
foo%
]
}

@ -1,3 +1,3 @@
#lang reader "bf-reader.rkt"
#lang reader "reader.rkt"
Greatest language ever!
++++-+++-++-++[>++++-+++-++-++<-]>.[
++++-+++-++-++[>++++-+++-++-++<-]>.

@ -1,5 +1,5 @@
#lang br
(module reader br
(require "bf-reader.rkt")
(require "reader.rkt")
(provide read-syntax))

Loading…
Cancel
Save