of Int2 and Prim2, your program should produce the
> output you expect. I'll add a note to the docs for
> make-constructor-style-printer.
>
> Ryan
>
>
> On Wed, Sep 2, 2020 at 10:07 PM Jeremy Siek wrote:
>
>> I'm seeing some bad behavior from make-cons
I'm seeing some bad behavior from make-constructor-style-printer when
there are lists mixed in with the structs. It seems to switch from print
mode to
write mode when going under a list. Whereas the default printer for
transparent structs gets this right. The following program demonstrates the
d
Thanks for the tip!
I found the following to work pretty well :)
#lang racket
(require racket/match)
(require racket/struct)
(struct Var (name)
#:methods gen:custom-write
[(define (write-proc ast port mode)
(match ast
[(Var x)
(write x port)]))])
(struct Num (value)
Hi All,
I'm looking into using Racket structs to represent abstract syntax trees.
I've gotten as far as defining gen:custom-write properties, but have not
yet figured out how to control indenting. Also, I'm not sure I'm just
calling
write-string, write, and newline in my gen:custom-write methods
4 matches
Mail list logo