afl
source code: https://github.com/AlexKnauth/afl
1 #lang afl
2 afl/reader
(require afl/reader) | package: afl |
procedure
(afl-read [in #:arg-str arg-str]) → any
in : input-port? = (current-input-port) arg-str : string? = (current-arg-string)
procedure
(afl-read-syntax [ source-name in #:arg-str arg-str]) → (or/c syntax? eof-object?) source-name : any/c = (object-name in) in : input-port? = (current-input-port) arg-str : string? = (current-arg-string)
The arg-str argument lets you specify something else to use as a placeholder instead of %.
> (require afl/reader) > (afl-read (open-input-string "#λ(+ % %2)")) '(lambda (%1 %2) (define-syntax % (make-rename-transformer #'%1)) (+ % %2))
> (afl-read (open-input-string "#λ(+ _ _2)") #:arg-str "_") '(lambda (_1 _2) (define-syntax _ (make-rename-transformer #'_1)) (+ _ _2))
afl/reader also exports these functions under the names read and read-syntax.
procedure
(make-afl-readtable [ orig-readtable] #:outer-scope outer-scope [ #:arg-str arg-str]) → readtable? orig-readtable : readtable? = (current-readtable) outer-scope : (-> syntax? syntax?) arg-str : string? = (current-arg-string)
The outer-scope argument should be a function that introduce scopes to preserve hygiene, normally produced by make-syntax-introducer and similar functions. For versions of racket that support it, these should generally be specified as use-site scopes.
The arg-str argument lets you specify something else to use as a placeholder instead of %, just like for afl-read.
procedure
(use-afl-readtable [ orig-readtable #:arg-str arg-str]) → void? orig-readtable : readtable? = (current-readtable) arg-str : string? = (current-arg-string)
This is mostly useful for the REPL.
Examples: |
|
> (require afl/reader) |
'(2 4 6) |
> (use-afl-readtable #:arg-str "_") |
'(2 4 6) |
parameter
(current-arg-string arg-str) → void? arg-str : string?