Thanks, indeed it does work. Although if I am not mistaken, I did not see mention of (current-print)
in "Beautiful Racket" or in the doc tutorial on writing languages. Do I have a special case, or is it routinely used but not mentioned? Is it because I did not provide a #%top-interaction form for my language yet? Thanks again! Raoul Le lundi 8 avril 2019 04:37:58 UTC+2, Sorawee Porncharoenwase a écrit : > > Not sure if this is *the* right way, but it should work: > > (define-syntax (handle-sentence stx) > (syntax-case stx () > [(handle-sentence _) #'((current-print) (#%datum . 2))])) > > > On Sun, Apr 7, 2019 at 5:40 PM Raoul Schorer <raoul....@gmail.com > <javascript:>> wrote: > >> Hi all, >> >> I am trying to write my first language based upon Beautiful Racket (which >> is amazing, BTW!). >> >> Almost everything works, but when I expand a syntax fragment, I need to >> add a print function to make the result display (display, displayln, >> writeln, etc.). >> I followed the "funstacker" tutorial ( source listing here ) and the >> tutorial does use "display" in the "funstacker-module-begin" macro. >> <https://beautifulracket.com/funstacker/source-listing.html> >> >> However, I expected something like: >> >> (define-syntax my-module-begin >> (make-wrapping-module-begin #'handle-sentence)) >> >> (define-syntax (handle-sentence stx) >> (syntax-case stx () >> [(handle-sentence _) #'(#%datum . 2)])) >> >> in my expander to allow me to return 2, but in fact it only displays 2 >> (apparently as a string) if I do: >> >> (define-syntax (handle-sentence stx) >> (syntax-case stx () >> [(handle-sentence _) #'(display (#%datum . 2))])) >> >> How can I return 2 as a number, as you get when typing 2 in the #lang >> racket REPL? >> >> Thanks! >> Raoul >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Racket Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to racket...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.