Re: [racket-users] Method gen:custom-write of a struct not working within lists

2021-03-04 Thread Sam Tobin-Hochstadt
On Thu, Mar 4, 2021 at 3:24 PM Dimaugh Silvestris wrote: > > On Thu, 4 Mar 2021 at 19:29, Sam Tobin-Hochstadt wrote: >> >> It doesn't print that way because that wouldn't turn back into the original >> value when evaluated, since it's quoted. > > > Is there any other way? > If not, I might consi

Re: [racket-users] Method gen:custom-write of a struct not working within lists

2021-03-04 Thread Dimaugh Silvestris
On Thu, 4 Mar 2021 at 19:29, Sam Tobin-Hochstadt wrote: > It doesn't print that way because that wouldn't turn back into the > original value when evaluated, since it's quoted. > Is there any other way? If not, I might consider the possibility of having a struct type for each of those ugens, but

Re: [racket-users] Method gen:custom-write of a struct not working within lists

2021-03-04 Thread Yury Bulka
Wow, so great to hear the a SuperCollider client in Racket is on the horizon:) -- Yury Bulka https://mamot.fr/@setthemfree #NotOnFacebook Dimaugh Silvestris writes: > I have a struct defined as: > (struct ugen sc.unit (name rate inputs) > #:methods gen:custom-write > [(define write-proc

Re: [racket-users] Method gen:custom-write of a struct not working within lists

2021-03-04 Thread Sam Tobin-Hochstadt
I think you want to add `#:property prop:custom-print-quotable 'never` to that struct declaration, and then it will behave as you wanted. Sam On Thu, Mar 4, 2021 at 11:44 AM Dimaugh Silvestris wrote: > > I have a struct defined as: > (struct ugen sc.unit (name rate inputs) > #:methods gen:cust

[racket-users] Method gen:custom-write of a struct not working within lists

2021-03-04 Thread Dimaugh Silvestris
I have a struct defined as: (struct ugen sc.unit (name rate inputs) #:methods gen:custom-write [(define write-proc (make-constructor-style-printer [λ (x) (let [(rate (ugen-rate x)) (name (symbol-append (ugen-name x) ':))] (cond [(eq? rate 'ar) name]