Trying to convert the following to typed Racket:

(define (unique list message . messageargs)
  ; return the only element of the list, or '() if there is none.
  ; Produce message if not just one. 
  (if (equal? 1 (length list)) (car list)
     (begin
       (apply fprintf (cons anomaly (cons message messageargs)))
       (if (null? list) list (car list))
       )
     )
)

It's an error message function tat accepts a list to test.
If the test fails it uses fprintf to print a message with the 
arguments for the ~s items.

I got so far, but I don't know what to do with the . messageargs :

(define (unique [list (Listof Any)] [message : String] . messageargs)
  ; return the only element of the list, or '() if there is none.
  ; Produce message if not just one. 
  (if (equal? 1 (length list)) (car list)
     (begin
       (apply fprintf (cons anomaly (cons message messageargs)))
       (if (null? list) list (car list))
       )
     )
)

-- 
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 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200410234906.5wy5kgzl2qfwd2db%40topoi.pooq.com.

Reply via email to