Wow, so great to hear the a SuperCollider client in Racket is on the horizon:)

--
Yury Bulka
https://mamot.fr/@setthemfree
#NotOnFacebook



Dimaugh Silvestris <dimaughsilvest...@gmail.com> writes:

> 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]
>                      [else (symbol-append
>                             name rate)]))]
>       [λ (x) (ugen-inputs x)]))] #:transparent)
>
> So that (ugen 'sinosc 'ar (1 2)) prints as (sinosc: 1 2), which 
> incidentally it's the same as the function call that creates that value, 
> that is: (sinosc: 3 4) creates the struct instance (ugen 'sinosc 'ar (3 
> 4)). *
>
> The problem is, within a list it prints like '(#<sinosc:: 1 2>), which is 
> quite ugly.
>
> * I don't know if this is a smart choice. I'm building a SuperCollider 
> client, and in SuperCollider there's hundreds of ugens (unit generators, 
> such as oscillators, filters, etc).
> Because there's hundreds of them, I thought it might be heavy on memory or 
> cpu to declare a specific struct for each one of them; so I choose instead 
> to declare only constructors that build different instances of the ugen 
> struct.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/87tupqelxo.fsf%40privacyrequired.com.

Reply via email to