I have a question regarding how sequence abstraction works in TR. In the
sequence part of the docs it says that a sequence can consist of lists or
vectors among other things. But does this make a function which ideally accepts
a (Listof a) to accept something that is declared as a (Sequenceof a)? For
example, in TR this works:
(: x (Sequenceof Symbol))
(define x '(a b c d))
However, this shows a type mismatch:
(: step (All (a)
(-> (-> a (Sequenceof a) (Sequenceof a))
(define (step fn x seq)
(fn x seq))
(step (ann cons (-> Symbol (Listof Symbol) (Listof Symbol)))
Type Checker: Polymorphic function `step' could not be applied to arguments:
Expected: (-> a (Sequenceof a) (Sequenceof a))
Given: (-> Symbol (Listof Symbol) (Listof Symbol))
Expected: (Sequenceof a)
Given: (List 'b 'c)
I think, trying to instantiate the polymorphic step function might help but I
was not able to figure out how.
Thanks in advance.
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.