[racket] Type of argument in a function

From: David Van Horn (dvanhorn at cs.umd.edu)
Date: Sun Jul 20 08:59:30 EDT 2014

On 7/20/14, 7:04 AM, קוראל אלימלך wrote:
> How can i define that a function will get an integer argument?
> 
> is its possible?
> 
> for example:
> (define (func (x::Number))) /// its not working that way
> 
> and if ill call the function with string there will be an error..

In addition to the suggestions to use Typed Racket, you may also want to
read about contracts:

(define/contract (f x) (-> integer? integer?)
  (* x x))

http://docs.racket-lang.org/guide/contracts.html

David




Posted on the users mailing list.