开发者

Setting default argument value in Racket

Is it possible to set a def开发者_高级运维ault value to some of arguments in Racket?

Like so in Python:

def f(arg=0)
    ...


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜