Re: [racket-users] Computed properties for a struct?

2021-06-04 Thread Sorawee Porncharoenwase
I think you can create a custom accessor, and use macros to avoid the Royal Pain. One question is, is the derived field expensive to compute? If not, your custom accessor can just compute the output every time it’s called. But if it’s expensive, you can use memoization. Both approaches have the be

[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)

[racket-users] This v 8.1 collection path looks incorrect...

2021-06-04 Thread Don Green
(current-library-collection-paths) '(# # #) I suspect the above is incorrect because I think the 8.1 path should be to dir: /pkgs rather than /collects. Like this: # -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this g

[racket-users] Re: config.rktd

2021-06-04 Thread Don Green
Now that I have learned of: config.rktd, I think I'd rather use it, if it can be used to set current-library-collection paths. Should I just add to the config.rktd hash list: (current-library-collection paths . '(# # #)) -- You received this message because you are subscribed to the Google G

Re: [racket-users] Regarding collections ...

2021-06-04 Thread Don Green
To answer Mathew Flatt's question: "Do you expect 3" (paths) "because you have an environment variable set, or something like that? " Answer: Yes. I can run a shell file that contains: #! /bin/bash export PLTCOLLECTS="/home/don/.plt-scheme/4.2.1/collects:" Many of my programs are accessible from

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

2021-06-04 Thread flirora
Thanks for the answers! On Thursday, 3 June 2021 at 17:26:57 UTC-4 shhyou wrote: > In addition to the constructor, `foo` is also used for compile-time > struct information. To avoid this, either supply #:name to designate a > different identifier for compile-time struct type information, or > dec

Re: [racket-users] Regarding collections ...

2021-06-04 Thread Matthew Flatt
At Thu, 3 Jun 2021 20:26:59 -0700 (PDT), Don Green wrote: > Using DrRacket in linux: > When I run DrRacket from a terminal, > > (current-library-collection-paths) returns the expected paths, 3 of them. > > However, when I open one of my .ss files which is associated with drracket, > > the file o