Tired of writing:
#:methods gen:custom-write
[(define write-proc
(make-constructor-style-printer
(lambda (x) blablabla)
(lambda (x) blablabla)))]
I made this macro:
(define-syntax (print-as stx)
(syntax-case stx []
{[_ lam1 lam2]
#'[(define write-proc
(make-constructor-style-printer
lam1 lam2))]}))
So I could just:
(struct point (x y)
#:methods gen:custom-write
[print-as
(lambda (obj) 'p)
(lambda (obj)
(list [point-x obj] [point-y obj]))])
But I get a bad syntax error. I've tried many subtle changes to no avail.
What am I doing wrong?
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/CAN4YmRH0jUXyG3YMKojrP2WSAKunrCjtN%3DyTFN2dPjmvvQDVdg%40mail.gmail.com.