PasteRack.org
Paste # 24284
2019-07-03 08:47:21

Forked from paste # 63115.

Fork as a new paste.

Paste viewed 326 times.


Embed:

how to define a default parameter value for a function in t/r?

  1. #lang typed/racket
  2.  
  3. ;; how to define a default parameter value for a function in t/r?
  4.  
  5. (: foo (->* () (Any) Any))
  6. (define (foo [bar 0])
  7.   bar)
  8.  
  9. (foo 1) ; succeeds
  10. (foo) ; type checker error: wrong number of arguments!

=>

- : Any

1

- : Any

0