racket-tw/racket-tw.github.io

tutorial typed/racket missing function overloading and important tips

Closed this issue · 0 comments

function overloading(case-lambda):

(: a (case-> (-> Number)
                     (-> Number Number)))
(define a
  (case-lambda
    [() 0]
    [([x : Number]) x]))

important tips:

  • inst: this is important since some builtin function is case-lambda and has polymorphism make provide concrete type be quite important.
  • ann: #{x : Number} 7 or (ann x Number) 7