Re: [racket-users] read-eval-print-loop, #%top-interaction, and define

2019-09-24 Thread Alexis King
> On Sep 24, 2019, at 23:01, Jesse Alama wrote: > > The question is: we do we get the error with define if we know that step is > undefined? Shouldn't we learn, first, that step is undefined? The top level is hopeless. Unlike in a module, an unbound identifier at the top level is not a syntax

Re: [racket-users] read-eval-print-loop, #%top-interaction, and define

2019-09-24 Thread Jesse Alama
I managed to solve my problem, thanks to the suggestion that #%top-interaction should work as I expect (that is, allow define); your example shows that I was going down the wrong path in my thinking about the issue. What I found is a simple mistake: my expander wraps the define in another form

Re: [racket-users] read-eval-print-loop, #%top-interaction, and define

2019-09-24 Thread Sam Tobin-Hochstadt
It's fine to have `#%top-interaction` around a `define`: ``` Welcome to Racket v7.4.0.10. > (#%top-interaction . (define x 1)) > x 1 ``` My guess is that your `#%top-interaction` is doing something that puts it in an expression context. Sam On Tue, Sep 24, 2019 at 8:34 AM Jesse Alama wrote: >

[racket-users] read-eval-print-loop, #%top-interaction, and define

2019-09-24 Thread Jesse Alama
I'm working on a REPL for a #lang in which one can make definitions. One writes $x := 5 and this gets parsed into an S-expression like (assignment "x" 5) The #lang is not based on S-expressions, but I believe that that's irrelevant (though I may be wrong). Naturally enough, I've set up the