20
votes

Is it possible to set a default value to some of arguments in Racket?

Like so in Python:

def f(arg=0)
    ...
1

1 Answers

29
votes

Yes; take a look at: declaring optional arguments.

For example:

(define (f [arg 0])
  (* arg 2))

Racket also supports functions with keyword arguments. The link should lead to documentation that talks about them too. Good luck!