Skip to content

Instantly share code, notes, and snippets.

@countvajhula
Created September 18, 2020 19:31
Show Gist options
  • Save countvajhula/caff22de353ae4dc4caedf7ee1d1d856 to your computer and use it in GitHub Desktop.
Save countvajhula/caff22de353ae4dc4caedf7ee1d1d856 to your computer and use it in GitHub Desktop.
racket variadic contract
#lang racket
(require racket/contract)
(define/contract (hello . args)
(-> any/c ... any/c)
(display args))
(hello)
(hello 1)
(hello 1 2 3)
(hello 1 2 3 4 5 6)
(define/contract (hello2 . args)
(-> any/c any/c ... any/c)
(display args))
;(hello2) ;=> error
(hello2 1)
(hello2 1 2 3)
(hello2 1 2 3 4 5 6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment