aful
source code: https://github.com/jsmaniac/aful/
1 #lang aful
2 aful/reader
(require aful/reader) | package: aful |
procedure
(aful-read [in #:arg-str arg-str]) → any
in : input-port? = (current-input-port) arg-str : string? = (current-arg-string)
procedure
(aful-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 aful/reader) > (aful-read (open-input-string "#λ(+ % %2)")) '(lambda (%1 %2) (define-syntax % (make-rename-transformer #'%1)) (+ % %2))
> (aful-read (open-input-string "#λ(+ _ _2)") #:arg-str "_") '(lambda (_1 _2) (define-syntax _ (make-rename-transformer #'_1)) (+ _ _2))
aful/reader also exports these functions under the names read and read-syntax.
procedure
(make-aful-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 aful-read.
procedure
(use-aful-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 aful/reader) |
'(2 4 6) |
> (use-aful-readtable #:arg-str "_") |
'(2 4 6) |
parameter
(current-arg-string arg-str) → void? arg-str : string?