I am trying to add types to some numerical rocket code in the hope of making it faster, but I am stuck in working on the macro / list extension in the code below.
(: index-member ((Listof Any) (Listof Any) -> (Listof Index))) (define (index-member xs ys) (filter-not negative? (for/list ([(ann i Index) (in-range (ann (length xs) Index))]) (if (member (list-ref xs i) ys) i -1))))
This function returns the index list of foreach x, which is a member of y. It works on Racket, but it seems like I can't get past the Typed Racket type check. In particular, the error:
Type Checker: error when expanding a macro - insufficient type information in typecheck. add additional type annotations to: (for / list ((((ann index) (in-range (ann (length xs) Index)))) (if (member (list-ref xs i) ys) -1))
Can you provide annotations that go past type checking and / or explain why these type annotations are insufficient?
source share