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
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
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
---
3 matches
Mail list logo