[racket-users] Computed properties for a struct?

2021-06-04 Thread flirora
Is there a way to define a struct so that it has a field whose value is filled in (instead of passed to the constructor) with a value derived from other fields? For example, could you define a struct foo with two explicit fields, x and y, plus a field called z whose value is computed as (+ x y)

Re: [racket-users] Defining a function with the same name as a struct with a different constructor name

2021-06-04 Thread flirora
ngs appear. In > this context, some of `foo`'s lexical information is reserved so that > `struct-out` works correctly. > > > > On 6/3/21 5:01 PM, flirora wrote: > > > > > > Am I correct in assuming that given a definition like > > > > (struct f

[racket-users] Defining a function with the same name as a struct with a different constructor name

2021-06-03 Thread flirora
Am I correct in assuming that given a definition like (struct foo (x) #:constructor-name bar) I then can't define something named foo in the same module, even though there's no constructor called foo? -- You received this message because you are subscribed to the Google Groups "Racket Users"