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.scho...@gmail.com>
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-users+unsubscr...@googlegroups.com.
> 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.

Reply via email to