[plt-scheme] $-expressions (was: How do I convert (values ...) ...)
On Mar 11, Neil Toronto wrote:
>
> It plays nicely with at-exp (as long as at-exp goes second; not my
> fault, AFAICT - it should compose with almost any reader):
The scribble reader is careful to extend the current readtable rather
than make up a new one, so it should work in any order. But, perhaps
in this particular example
> #reader "rest-reader.ss"
> #lang at-exp scheme
> (define my-list @list[1 $list 2 3]) ; = (list 1 (list 2 3))
something else is resetting it. In any case, if you really want to do
this the right way, you should create a module reader like at-exp,
which would be used with
#lang rest-exp at-exp scheme
but since it's just a random file, you'd instead use
#lang reader "path/to/rest-lang.ss" at-exp scheme
> That reminds me: when you copy @-expressions into the REPL, they
> don't parse. But scribble/reader.ss could do this more easily than
> rest-reader.ss does.
>
> (Eli, I have complained. Do I receive? :p)
I'm not sure what you mean by "could do this more easily than
rest-reader.ss does" -- both cases should be similar. The problem
here is that currently the lang/reader facility has only a reader for
module code, and it should eventually be extended to also have an
expression reader, which would then be used by all the usual parties
(the mzscheme repl, the drscheme repl, the sandbox repl).
In the case of languages that simply extend a readtable, that's
simple: you specify a reader function which is used repeatedly to read
the module (which is what `syntax/module-reader' does), and the same
function should eventually be used for repl expressions. But if you
specify a whole-module reader, then you'll need to provide an
expression reader in addition. In some cases that might not even be
possible, and all of the above repls should probably refuse to let you
do any interaction when its missing.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!