Re: [racket-users] structs vs classes

2017-12-06 Thread Philip McGrath
> 1) At least one of the fields must be set at creation > What does it mean for one of the fields not to be set at creation? Is there implicitly some not-initialized value like #f that is also valid for the constructor? Do you want your accessor functions to raise an error if someone tries to acce

[racket-users] Re: structs vs classes

2017-12-06 Thread Alex Harsanyi
In my code, I started experimenting with using immutable structs and "updating" them using 'struct-copy'. I had to write my own "update" functions, but I was surprised at how elegant the resulting code was. I believe (although I did not check) that the guard function is invoked every time a

[racket-users] structs vs classes

2017-12-06 Thread David Storrs
I have a struct that looks like this (simplified for concision): (struct db-chunk (scratchdir-path chunkdir-path) #:mutable) I'd like to ensure that: 1) At least one of the fields must be set at creation 2) Both fields will accept only a path-string? value 3) Both fields will return string? when

[racket-users] Scribble Top-level Evaluation Order of Define

2017-12-06 Thread Joe Gibbs Politz
As an example, this prints twoonethree: #lang scribble/base @(printf "one") @(printf foo) @(define foo (begin (printf "two") "three")) Context: I'm using Scribble to generate an exam, and I have some uses of (set-random-seed) on the first few lines to set state for shuffling question order la

Re: [racket-users] Unit test inner procedures

2017-12-06 Thread Sean Kanaley
Regarding submod testing, would it make sense to have a submod* form that recursively imports? I've recently become a fan of this approach to testing inner procedures but it seems to require both (submod "." ) (submod "." test), or maybe a version that specifically imports all tests recursively.