PasteRack.org
Paste # 7658
2013-10-08 00:56:39

Fork as a new paste.

Paste viewed 46546 times.


Embed:

typed/racket

  1. #lang typed/racket
  2. ;; Using higher-order occurrence typing
  3. (define-type SrN (U String Number))
  4. (: tog ((Listof SrN) -> String))
  5. (define (tog l)
  6.   (apply string-append (filter string? l)))
  7. (tog (list 5 "hello " 1/2 "world" (sqrt -1)))

=>

- : String

"hello world"