2
votes

Can someone explain the difference between using drracket with swindle (any of the versions) and firing up the interpreter as: racket -I swindle

Many expressions evaluate the same in both environments, but some don't. For example:

(let-syntax ((let* (syntax-rules () ((let* a b) "You used let*")))) (let* 3 4))

... evaluates to "You used let*" in every scheme-based language I tried in drracket. However, it fails in the interpreter brought up by "racket -I swindle" on the command line with the error

; readline-input:1:20: syntax-rules: unbound identifier; ; also, no #%app syntax transformer is bound in the transformer phase ; at: syntax-rules ; in: (syntax-rules () ((let* a b) "You used let*")) ; [,bt for context]

1
Racket Q&A happens on the slack, email-list or IRC it is better to ask on one of those Ask questions at a) Racket Slack Signup: racket-slack.herokuapp.com then you can login to racket.slack.com b) mailing list groups.google.com/forum/#!forum/racket-users/join (no google ID required) c) Google Group groups.google.com/forum/#!forum/racket-users (same content as mailing-list) d) IRC #Racket channel on freenode. You can also search * documentation docs.racket-lang.org * mailing list groups.google.com/g/racket-usersStephen
sorry I forgot no formatting in comments on SO.Stephen

1 Answers

1
votes

Your example uses syntax-rules at phase 1 (aka the "for-syntax phase", aka the "transformer phase"), but it appears that the swindle module (unlike racket/base and racket) does not provide any bindings for-syntax. (It looks like swindle uses an old technique to provide phase-1 bindings that works for modules written in the swindle language but not for a REPL started with racket -l swindle.)

One workaround is to evaluate

(require (for-syntax racket/base))

before evaluating your example, and then your example should work as you expect.