i'm making program in plai-typed language, want use functions 'car' , 'cdr'
(require (typed-in racket (car : (pair -> any/c)) (cdr : (pair -> any/c))))
however gives me error pair:bad type
why this? 'type' should fill in instead of 'pair' since in documentation says input both function pair.
i tried typing 'pair' 'pair' 'pairs' 'pairs' none work
i think want (... * ...)
(require (typed-in racket (car : (('a * 'b) -> 'a)) (cdr : (('a * 'b) -> 'b)) (cons : ('a 'b -> ('a * 'b)))))
then:
> (cons 1 2) - (number * number) '(1 . 2) > (car (cons 1 2)) - number 1
valid types listed in https://docs.racket-lang.org/plai-typed/index.html#%28part._.types%29. any/c
or pair
not valid one.
also note there're pair
, fst
, snd
in plai-typed
.
Comments
Post a Comment