:transparent is definitely mentioned in the guide chapter on structures, maybe ch 5 On Fri, Aug 24, 2018 at 8:15 PM Ben Kovitz <bkov...@gmail.com> wrote:
> On Thursday, August 23, 2018 at 2:49:32 PM UTC-4, David K. Storrs wrote: > > For me, the first resorts in Racket are list and hash. If I'm going to do >> any heavy lifting with it then I move to struct: >> >> (hash 'username 'bob 'age 18) ; quick and easy, works well with >> database, useful print representation. Weak against typos, not easy to >> identify what a hash represents >> >> (struct user (username age) #:transparent) ; transparent means "show >> field values when printing" >> (user 'bob 18) ; well-defined accessors and setters so not vulnerable to >> typos, has an inbuilt predicate to identify 'user' structs. >> > > Ah, thanks! I spent about an hour trying to figure out inspectors and > didn't get anywhere, and I never would have guessed that :transparent means > to make the struct printable. This is the kind of thing I'm looking for: > very simple stuff that's crucial to know to be productive and usually takes > only a couple minutes to explain in person but is omitted in documentation. > > I take it, then, that no collection of these little things exists yet? > > Ben > > > -- > 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.