[racket] problem with map example in docs of typed/racket

From: Jos Koot (jos.koot at telefonica.net)
Date: Thu Aug 26 12:51:58 EDT 2010

See below,
Jos
 
In definitions window
 
#lang typed/racket 
(: map 
   (All (C A B ...) 
        ((A B ... B -> C) (Listof A) (Listof B) ... B 
                          -> 
                          (Listof C)))) 
(define (map f as . bss) 
  (if (or (null? as) 
          (ormap null? bss)) 
      null 
      (cons (apply f (car as) (map car bss))         ; These to lines
            (apply map f (cdr as) (map cdr bss)))))  ; are highlighted
 
Run, then in interactions window:
 

Welcome to DrRacket, version
5.0.1.3--2010-08-19(e55f0cade1d47b2edbc65e7dd61ddce2041814af/a) [3m].
Language: typed/racket.
. Type Checker: Polymorphic function map could not be applied to arguments:
Domain: (A B ... B -> C) (Listof A) (Listof B) ... B
Arguments: (All (a b) (case-lambda ((Pairof a b) -> a) ((Listof a) -> a)))
(List (Listof B) ... B)
 in: (map car bss)
. Type Checker: Bad arguments to function in apply:
Domain: A B ... B
Arguments: A Nothing *
 in: (apply f (car as) (map car bss))
. Type Checker: Polymorphic function map could not be applied to arguments:
Domain: (A B ... B -> C) (Listof A) (Listof B) ... B
Arguments: (All (a b) (case-lambda ((Pairof a b) -> b) ((Listof a) ->
(Listof a)))) (List (Listof B) ... B)
 in: (map cdr bss)
. Type Checker: Bad arguments to polymorphic function in apply:
Domain: (A B ... B -> C) (Listof A) (Listof B) ... B
Arguments: (A B ... B -> C) (Listof A) Nothing *
 in: (apply map f (cdr as) (map cdr bss))
. Type Checker: Summary: 4 errors encountered in:
  (map car bss)
  (apply f (car as) (map car bss))
  (map cdr bss)
  (apply map f (cdr as) (map cdr bss))
> 

 

 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100826/4a8e4e97/attachment.html>

Posted on the users mailing list.