Re: [racket-users] TR: Occurrence Typing with custom predicate

2020-03-24 Thread mmcdan
Hello Ben, Good call. I didn't think about the mutability of the container's contents with respect to types. My goal is to create a type that represents an immutable container. After exploring, it looks like there is a workaround: In the case of Vector, I can create a struct to hold the

Re: [racket-users] TR: Occurrence Typing with custom predicate

2020-03-24 Thread Ben Greenman
On 3/24/20, mmcdan wrote: > Hello, > > I'm trying to use occurrence typing for (Vectorof Symbol) or (Boxof > Symbol). > > Creating a custom predicate for (Listof Symbol) seems to work: > --- > #lang typed/racket > > (: los? (-> Any Boolean : (Listof Symbol))) > (define los? > (lambda (seq) (and

[racket-users] TR: Occurrence Typing with custom predicate

2020-03-24 Thread mmcdan
Hello, I'm trying to use occurrence typing for (Vectorof Symbol) or (Boxof Symbol). Creating a custom predicate for (Listof Symbol) seems to work: --- #lang typed/racket (: los? (-> Any Boolean : (Listof Symbol))) (define los? (lambda (seq) (and (list? seq) (andmap symbol? seq ---